typeprof 0.21.7 → 0.21.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +2 -2
- data/.gitignore +0 -1
- data/Gemfile.lock +2 -2
- data/lib/typeprof/analyzer.rb +1 -1
- data/lib/typeprof/cli.rb +14 -5
- data/lib/typeprof/import.rb +1 -1
- data/lib/typeprof/lsp.rb +22 -0
- data/lib/typeprof/type.rb +12 -7
- data/lib/typeprof/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f679437d629955ec31b3467826bd4114be2b02786bd31b15736681e52d8d01a
|
4
|
+
data.tar.gz: 8bd7c6403e4c7254e2de29a6d7515bd134996967266a138e2b11ca0834d604c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ea5197a66f4672a7804b6994d9613b09c55c000024aa78231a29cf6f531e398e507dc50b3fa0ac51f99ca1c64a6b259eee853421209fcc1034748d06f64c6b0
|
7
|
+
data.tar.gz: a334eafef1cb1a808066f2e11862d6af634d38f5360b100699e30d19551213fd8d2b5763f4fd31c3a32273441e1753f15fbb956b7f00856745f678f024f93f70
|
data/.github/workflows/main.yml
CHANGED
@@ -13,7 +13,7 @@ jobs:
|
|
13
13
|
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
14
14
|
with:
|
15
15
|
engine: cruby-truffleruby
|
16
|
-
min_version:
|
16
|
+
min_version: 3.0
|
17
17
|
|
18
18
|
build:
|
19
19
|
needs: ruby-versions
|
@@ -24,7 +24,7 @@ jobs:
|
|
24
24
|
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
25
25
|
runs-on: ubuntu-latest
|
26
26
|
steps:
|
27
|
-
- uses: actions/checkout@
|
27
|
+
- uses: actions/checkout@v4
|
28
28
|
- name: Set up Ruby
|
29
29
|
uses: ruby/setup-ruby@v1
|
30
30
|
with:
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
typeprof (0.21.
|
4
|
+
typeprof (0.21.8)
|
5
5
|
rbs (>= 1.8.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
docile (1.4.0)
|
12
12
|
power_assert (2.0.1)
|
13
13
|
rake (13.0.1)
|
14
|
-
rbs (3.0
|
14
|
+
rbs (3.2.0)
|
15
15
|
simplecov (0.21.2)
|
16
16
|
docile (~> 1.1)
|
17
17
|
simplecov-html (~> 0.11)
|
data/lib/typeprof/analyzer.rb
CHANGED
@@ -2273,7 +2273,7 @@ module TypeProf
|
|
2273
2273
|
_flag_args_fcall = flags[ 2] != 0
|
2274
2274
|
_flag_args_vcall = flags[ 3] != 0
|
2275
2275
|
_flag_args_simple = flags[ 4] != 0 # unused in TP
|
2276
|
-
|
2276
|
+
flags <<= 1 if RUBY_VERSION >= "3.3" # blockiseq flag was removed in 3.3
|
2277
2277
|
flag_args_kwarg = flags[ 6] != 0
|
2278
2278
|
flag_args_kw_splat = flags[ 7] != 0
|
2279
2279
|
_flag_tailcall = flags[ 8] != 0
|
data/lib/typeprof/cli.rb
CHANGED
@@ -23,7 +23,8 @@ module TypeProf
|
|
23
23
|
gem_rbs_features = []
|
24
24
|
show_version = false
|
25
25
|
max_sec = max_iter = nil
|
26
|
-
collection_path =
|
26
|
+
collection_path = nil
|
27
|
+
no_collection = false
|
27
28
|
|
28
29
|
load_path_ext = []
|
29
30
|
|
@@ -35,8 +36,8 @@ module TypeProf
|
|
35
36
|
opt.on("--version", "Display typeprof version") { show_version = true }
|
36
37
|
opt.on("-I DIR", "Add DIR to the load/require path") {|v| load_path_ext << v }
|
37
38
|
opt.on("-r FEATURE", "Require RBS of the FEATURE gem") {|v| gem_rbs_features << v }
|
38
|
-
opt.on("--collection PATH", "File path of collection configuration") { |v| collection_path = v }
|
39
|
-
opt.on("--no-collection", "Ignore collection configuration") {
|
39
|
+
opt.on("--collection PATH", "File path of collection configuration") { |v| collection_path = Pathname(v) }
|
40
|
+
opt.on("--no-collection", "Ignore collection configuration") { no_collection = true }
|
40
41
|
opt.on("--lsp", "LSP mode") {|v| options[:lsp] = true }
|
41
42
|
|
42
43
|
opt.separator ""
|
@@ -104,6 +105,14 @@ module TypeProf
|
|
104
105
|
raise OptionParser::InvalidOption.new("lsp options with non-lsp mode")
|
105
106
|
end
|
106
107
|
|
108
|
+
if !no_collection && collection_path && !collection_path.exist?
|
109
|
+
exit if show_version
|
110
|
+
raise OptionParser::InvalidOption.new("collection path not found (#{collection_path})")
|
111
|
+
end
|
112
|
+
|
113
|
+
collection_path ||= RBS::Collection::Config::PATH
|
114
|
+
collection_path = nil if no_collection
|
115
|
+
|
107
116
|
ConfigData.new(
|
108
117
|
rb_files: rb_files,
|
109
118
|
rbs_files: rbs_files,
|
@@ -118,9 +127,9 @@ module TypeProf
|
|
118
127
|
lsp_options: lsp_options,
|
119
128
|
)
|
120
129
|
|
121
|
-
rescue OptionParser::InvalidOption
|
130
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
|
122
131
|
puts $!
|
123
|
-
exit
|
132
|
+
exit 1
|
124
133
|
end
|
125
134
|
end
|
126
135
|
end
|
data/lib/typeprof/import.rb
CHANGED
@@ -31,7 +31,7 @@ module TypeProf
|
|
31
31
|
lock_path = RBS::Collection::Config.to_lockfile_path(collection_path)
|
32
32
|
if lock_path.exist?
|
33
33
|
collection_lock = RBS::Collection::Config::Lockfile.from_lockfile(lockfile_path: lock_path, data: YAML.load_file(lock_path.to_s))
|
34
|
-
collection_lock.gems.
|
34
|
+
collection_lock.gems.each_value {|gem| @loaded_gems << gem[:name] }
|
35
35
|
loader.add_collection(collection_lock)
|
36
36
|
else
|
37
37
|
raise "Please execute 'rbs collection install'"
|
data/lib/typeprof/lsp.rb
CHANGED
@@ -352,6 +352,7 @@ module TypeProf
|
|
352
352
|
}
|
353
353
|
end
|
354
354
|
|
355
|
+
@server.send_notification('typeprof.enableToggleButton')
|
355
356
|
@server.send_request("workspace/codeLens/refresh")
|
356
357
|
|
357
358
|
@server.send_notification(
|
@@ -827,6 +828,13 @@ module TypeProf
|
|
827
828
|
end
|
828
829
|
end
|
829
830
|
|
831
|
+
module MessageType
|
832
|
+
Error = 1
|
833
|
+
Warning = 2
|
834
|
+
Info = 3
|
835
|
+
Log = 4
|
836
|
+
end
|
837
|
+
|
830
838
|
class Server
|
831
839
|
class Exit < StandardError; end
|
832
840
|
|
@@ -861,6 +869,20 @@ module TypeProf
|
|
861
869
|
end
|
862
870
|
end
|
863
871
|
rescue Exit
|
872
|
+
rescue => e
|
873
|
+
msg = "Tyeprof fatal error: #{e.message}"
|
874
|
+
send_notification(
|
875
|
+
'window/showMessage',
|
876
|
+
type: MessageType::Error,
|
877
|
+
message: msg
|
878
|
+
)
|
879
|
+
send_notification(
|
880
|
+
'window/logMessage',
|
881
|
+
type: MessageType::Error,
|
882
|
+
message: "#{msg} Backtrace: #{e.backtrace}"
|
883
|
+
)
|
884
|
+
send_notification('typeprof.showErrorStatus')
|
885
|
+
retry
|
864
886
|
end
|
865
887
|
|
866
888
|
def send_response(**msg)
|
data/lib/typeprof/type.rb
CHANGED
@@ -734,14 +734,19 @@ module TypeProf
|
|
734
734
|
|
735
735
|
def []=(k_ty, v_ty)
|
736
736
|
k_ty.each_child_global do |k_ty|
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
if @map_tys[k_ty]
|
742
|
-
@map_tys[k_ty] = @map_tys[k_ty].union(v_ty)
|
737
|
+
if k_ty.is_a?(Type::Union)
|
738
|
+
# Flatten recursive union
|
739
|
+
self[k_ty] = v_ty
|
743
740
|
else
|
744
|
-
|
741
|
+
# This is a temporal hack to mitigate type explosion
|
742
|
+
k_ty = Type.any if k_ty.is_a?(Type::Array)
|
743
|
+
k_ty = Type.any if k_ty.is_a?(Type::Hash)
|
744
|
+
|
745
|
+
if @map_tys[k_ty]
|
746
|
+
@map_tys[k_ty] = @map_tys[k_ty].union(v_ty)
|
747
|
+
else
|
748
|
+
@map_tys[k_ty] = v_ty
|
749
|
+
end
|
745
750
|
end
|
746
751
|
end
|
747
752
|
end
|
data/lib/typeprof/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typeprof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.21.
|
4
|
+
version: 0.21.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yusuke Endoh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbs
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
|
-
rubygems_version: 3.5.
|
92
|
+
rubygems_version: 3.5.1
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: TypeProf is a type analysis tool for Ruby code based on abstract interpretation
|