Skip to content

Commit 3a9786b

Browse files
authored
Merge pull request #1507 from ksss/ancestors-invalid-type-application
Support `InvalidTypeApplication` on `#update_env`
2 parents 8dbfa9a + e8c3420 commit 3a9786b

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

lib/steep/services/signature_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def update_env(updated_files, paths:)
295295

296296
unless errors.empty?
297297
# Builder won't be used.
298-
factory = AST::Types::Factory.new(builder: _ = nil)
298+
factory = AST::Types::Factory.new(builder: RBS::DefinitionBuilder.new(env: env, ancestor_builder: builder))
299299
return errors.map {|error| Diagnostic::Signature.from_rbs_error(error, factory: factory) }
300300
end
301301

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class InvalidTypeApplicationClass < String[String]
2+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module InvalidTypeApplicationModule : String[int]
2+
end

smoke/diagnostics-rbs/test_expectations.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,30 @@
7070
severity: ERROR
7171
message: Cannot find a non-overloading definition of `foo` in `::InvalidMethodOverload`
7272
code: RBS::InvalidMethodOverload
73+
- file: invalid-type-application-class.rbs
74+
diagnostics:
75+
- range:
76+
start:
77+
line: 1
78+
character: 36
79+
end:
80+
line: 1
81+
character: 50
82+
severity: ERROR
83+
message: Type `::String` is not generic but used as a generic type with 1 arguments
84+
code: RBS::InvalidTypeApplication
85+
- file: invalid-type-application-module.rbs
86+
diagnostics:
87+
- range:
88+
start:
89+
line: 1
90+
character: 38
91+
end:
92+
line: 1
93+
character: 49
94+
severity: ERROR
95+
message: Type `::String` is not generic but used as a generic type with 1 arguments
96+
code: RBS::InvalidTypeApplication
7397
- file: invalid-type-application.rbs
7498
diagnostics:
7599
- range:

0 commit comments

Comments
 (0)