solargraph 0.47.1 → 0.47.2
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/CHANGELOG.md +4 -0
- data/lib/solargraph/complex_type.rb +4 -0
- data/lib/solargraph/diagnostics/rubocop.rb +1 -1
- data/lib/solargraph/type_checker/checks.rb +13 -0
- data/lib/solargraph/type_checker.rb +2 -2
- data/lib/solargraph/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d35030ae56f6aaff108a24e4fb06713f911ba4366feb2223b24ad0ea4568522
|
4
|
+
data.tar.gz: a9eeaee16171bc762922ac55d10c61d53bcfe6ef1df0b20623c81e0978a80c7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b13ae6284def50f72c9aaed3cad6f89e879306dc8421b1c13f622e18181e6d9aaecf4f57ffa56601a00c92066557bb798d3e8ee6a397920ff0072f909e05463
|
7
|
+
data.tar.gz: 9a0366309ebe9a4a784c2933a8452e2084c376ff9aa3cd6c3bf555f4d6ce046f11245679c688bef43c6c1e67d94b70afb4250149c9b01b80fc525b80a80b6486
|
data/CHANGELOG.md
CHANGED
@@ -61,6 +61,19 @@ module Solargraph
|
|
61
61
|
false
|
62
62
|
end
|
63
63
|
|
64
|
+
# @param api_map [ApiMap]
|
65
|
+
# @param inferred [ComplexType]
|
66
|
+
# @param expected [ComplexType]
|
67
|
+
# @return [Boolean]
|
68
|
+
def all_types_match? api_map, inferred, expected
|
69
|
+
return duck_types_match?(api_map, expected, inferred) if expected.duck_type?
|
70
|
+
inferred.each do |inf|
|
71
|
+
next if inf.duck_type?
|
72
|
+
return false unless expected.any? { |exp| exp == inf || either_way?(api_map, inf, exp) }
|
73
|
+
end
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
64
77
|
# @param api_map [ApiMap]
|
65
78
|
# @param expected [ComplexType]
|
66
79
|
# @param inferred [ComplexType]
|
@@ -105,7 +105,7 @@ module Solargraph
|
|
105
105
|
result.push Problem.new(pin.location, "#{pin.path} return type could not be inferred", pin: pin)
|
106
106
|
end
|
107
107
|
else
|
108
|
-
unless (rules.rank > 1 ?
|
108
|
+
unless (rules.rank > 1 ? all_types_match?(api_map, inferred, declared) : any_types_match?(api_map, declared, inferred))
|
109
109
|
result.push Problem.new(pin.location, "Declared return type #{declared} does not match inferred type #{inferred} for #{pin.path}", pin: pin)
|
110
110
|
end
|
111
111
|
end
|
@@ -177,7 +177,7 @@ module Solargraph
|
|
177
177
|
result.push Problem.new(pin.location, "Variable type could not be inferred for #{pin.name}", pin: pin)
|
178
178
|
end
|
179
179
|
else
|
180
|
-
unless
|
180
|
+
unless any_types_match?(api_map, declared, inferred)
|
181
181
|
result.push Problem.new(pin.location, "Declared type #{declared} does not match inferred type #{inferred} for variable #{pin.name}", pin: pin)
|
182
182
|
end
|
183
183
|
end
|
data/lib/solargraph/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solargraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.47.
|
4
|
+
version: 0.47.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backport
|