Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions lib/rbs/definition_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,6 @@ def validate_variable(var)
if r.source.instance_of?(AST::Members::ClassInstanceVariable) && l.declared_in == r.declared_in
raise ClassInstanceVariableDuplicationError.new(member: l.source)
end
when AST::Members::ClassVariable
if r.source.instance_of?(AST::Members::ClassVariable)
raise ClassVariableDuplicationError.new(member: l.source)
end
end
end

Expand Down
3 changes: 0 additions & 3 deletions lib/rbs/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,6 @@ class InstanceVariableDuplicationError < VariableDuplicationError
class ClassInstanceVariableDuplicationError < VariableDuplicationError
end

class ClassVariableDuplicationError < VariableDuplicationError
end

class UnknownMethodAliasError < DefinitionError
include DetailedMessageable

Expand Down
6 changes: 0 additions & 6 deletions sig/errors.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,9 @@ module RBS
end

class InstanceVariableDuplicationError < VariableDuplicationError
def self.check!: (variables: Hash[Symbol, Definition::Variable], member: AST::Members::InstanceVariable, type_name: TypeName) -> void
end

class ClassInstanceVariableDuplicationError < VariableDuplicationError
def self.check!: (variables: Hash[Symbol, Definition::Variable], member: AST::Members::ClassInstanceVariable, type_name: TypeName) -> void
end

class ClassVariableDuplicationError < VariableDuplicationError
def self.check!: (variables: Hash[Symbol, Definition::Variable], member: AST::Members::ClassVariable, type_name: TypeName) -> void
end

# The `alias` member declares an alias from unknown method
Expand Down
33 changes: 0 additions & 33 deletions test/rbs/definition_builder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2838,11 +2838,6 @@ class ClassInstanceVariable
self.@class_instance: Integer
self.@class_instance: Integer
end

class ClassVariable
@@class: Integer
@@class: Integer
end
EOF

manager.build do |env|
Expand All @@ -2866,34 +2861,6 @@ class ClassVariable
assert_raises(RBS::ClassInstanceVariableDuplicationError) do
builder.build_singleton(type_name("::ClassInstanceVariable"))
end
assert_raises(RBS::ClassVariableDuplicationError) do
builder.build_instance(type_name("::ClassVariable"))
end
end
end

SignatureManager.new do |manager|
manager.add_file("inherited.rbs", <<-EOF)
class A
@instance: Integer
self.@class_instance: Integer
@@class: Integer
end

class B < A
@instance: Integer
self.@class_instance: Integer
@@class: Integer
end
EOF

manager.build do |env|
builder = DefinitionBuilder.new(env: env)

builder.build_instance(type_name("::A"))
assert_raises(RBS::ClassVariableDuplicationError) do
builder.build_instance(type_name("::B"))
end
end
end
end
Expand Down