steep 0.16.3 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b1c04c7f20a2ed355b58570363447b3e8f2bd1710407de1e23c7b9fbe279cb8
4
- data.tar.gz: 62101db41144f3fd218ee8478ab377f3414ad1d8a7689ac73356aa28bf7f6842
3
+ metadata.gz: f60fa7be29b63a36a6f25cb94138d558d0bbaa652cb40ab5f2a4a24f1a0d58ac
4
+ data.tar.gz: 83582c3c37c5afefe079a545860e96a8edce020b891755b49f6a1cbdf53cce04
5
5
  SHA512:
6
- metadata.gz: d8ac130b1adb7755709f4b1590939b442d6d4b4aa5ea38a95423db539a1b52b0c4078abf1a543b92a84477d99846d5ab30060dc26c693f52785de0c205041a2d
7
- data.tar.gz: e7ccec14707e49d51b88429ab0922c4e6fbbc190bbafb0e107c30ea681b04415245e40708909fd28458a89a565a816fd88a6bfa1c14b76e24185a2ece153148c
6
+ metadata.gz: 38e917a0030c6f0f993d6d0bd6bd9e26bb955cdd08609802df87992f7242933f03f3b35311c53fec9e6f74a12cb5d2237c5e03d6461fc56f44d019b8011ed12e
7
+ data.tar.gz: 5a5fa1b3502b23d3a9e6c1391de6c3313e8309adbbf353589eda27ed356414201ec2c6f6cdceb01b5f2afd8425a777a3d02921e509ba15674295c65f04bbdc0e
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.17.0 (2020-06-13)
6
+
7
+ * Fix `steep watch` and `steep langserver` to correctly handle error message filterings based on options ([#152](https://github.com/soutaro/steep/pull/152))
8
+ * Fix typing of collections ([#151](https://github.com/soutaro/steep/pull/151))
9
+
5
10
  ## 0.16.3
6
11
 
7
12
  * Fix `steep watch` ([#147](https://github.com/soutaro/steep/pull/147))
@@ -53,18 +53,7 @@ module Steep
53
53
  status.type_check_sources.each do |source_file|
54
54
  case source_file.status
55
55
  when Project::SourceFile::TypeCheckStatus
56
- source_file.errors.reject do |error|
57
- case
58
- when error.is_a?(Errors::FallbackAny)
59
- target.options.allow_fallback_any
60
- when error.is_a?(Errors::MethodDefinitionMissing)
61
- target.options.allow_missing_definitions
62
- when error.is_a?(Errors::NoMethod)
63
- target.options.allow_unknown_method_calls
64
- when error.is_a?(Errors::UnknownConstantAssigned)
65
- target.options.allow_unknown_constant_assignment
66
- end
67
- end.each do |error|
56
+ source_file.errors.select {|error| target.options.error_to_report?(error) }.each do |error|
68
57
  error.print_to stdout
69
58
  end
70
59
  when Project::SourceFile::TypeCheckErrorStatus
@@ -37,6 +37,21 @@ module Steep
37
37
  self.allow_unknown_constant_assignment = true
38
38
  self.allow_unknown_method_calls = true
39
39
  end
40
+
41
+ def error_to_report?(error)
42
+ case
43
+ when error.is_a?(Errors::FallbackAny)
44
+ !allow_fallback_any
45
+ when error.is_a?(Errors::MethodDefinitionMissing)
46
+ !allow_missing_definitions
47
+ when error.is_a?(Errors::NoMethod)
48
+ !allow_unknown_method_calls
49
+ when error.is_a?(Errors::UnknownConstantAssigned)
50
+ !allow_unknown_constant_assignment
51
+ else
52
+ true
53
+ end
54
+ end
40
55
  end
41
56
  end
42
57
  end
@@ -47,7 +47,7 @@ module Steep
47
47
 
48
48
  Steep.logger.info "Finished type checking: #{path}@#{target.name}"
49
49
 
50
- diagnostics = source_diagnostics(source)
50
+ diagnostics = source_diagnostics(source, target.options)
51
51
 
52
52
  writer.write(
53
53
  method: :"textDocument/publishDiagnostics",
@@ -58,7 +58,7 @@ module Steep
58
58
  )
59
59
  end
60
60
 
61
- def source_diagnostics(source)
61
+ def source_diagnostics(source, options)
62
62
  case status = source.status
63
63
  when Project::SourceFile::ParseErrorStatus
64
64
  []
@@ -80,7 +80,7 @@ module Steep
80
80
  )
81
81
  ]
82
82
  when Project::SourceFile::TypeCheckStatus
83
- status.typing.errors.map do |error|
83
+ status.typing.errors.select {|error| options.error_to_report?(error) }.map do |error|
84
84
  loc = error.location_to_str
85
85
 
86
86
  LSP::Interface::Diagnostic.new(
@@ -1037,10 +1037,10 @@ module Steep
1037
1037
  case child.type
1038
1038
  when :pair
1039
1039
  key, value = child.children
1040
- key_types << synthesize(key).type.yield_self do |type|
1040
+ key_types << synthesize(key, hint: key_hint).type.yield_self do |type|
1041
1041
  select_super_type(type, key_hint)
1042
1042
  end
1043
- value_types << synthesize(value).type.yield_self do |type|
1043
+ value_types << synthesize(value, hint: value_hint).type.yield_self do |type|
1044
1044
  select_super_type(type, value_hint)
1045
1045
  end
1046
1046
  when :kwsplat
@@ -1256,7 +1256,7 @@ module Steep
1256
1256
  end
1257
1257
  end
1258
1258
  else
1259
- [select_super_type(synthesize(e).type, element_hint)]
1259
+ [select_super_type(synthesize(e, hint: element_hint).type, element_hint)]
1260
1260
  end
1261
1261
  end
1262
1262
  array_type = AST::Builtin::Array.instance_type(AST::Types::Union.build(types: element_types))
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "0.16.3"
2
+ VERSION = "0.17.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.3
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-27 00:00:00.000000000 Z
11
+ date: 2020-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler