Skip to content

Commit 17e4b55

Browse files
authored
Merge pull request #2305 from ruby/no-class-variable-duplication-validation
No class variable duplication validation
2 parents c62edeb + 59f2c4e commit 17e4b55

File tree

4 files changed

+0
-46
lines changed

4 files changed

+0
-46
lines changed

lib/rbs/definition_builder.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,10 +575,6 @@ def validate_variable(var)
575575
if r.source.instance_of?(AST::Members::ClassInstanceVariable) && l.declared_in == r.declared_in
576576
raise ClassInstanceVariableDuplicationError.new(member: l.source)
577577
end
578-
when AST::Members::ClassVariable
579-
if r.source.instance_of?(AST::Members::ClassVariable)
580-
raise ClassVariableDuplicationError.new(member: l.source)
581-
end
582578
end
583579
end
584580

lib/rbs/errors.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,6 @@ class InstanceVariableDuplicationError < VariableDuplicationError
345345
class ClassInstanceVariableDuplicationError < VariableDuplicationError
346346
end
347347

348-
class ClassVariableDuplicationError < VariableDuplicationError
349-
end
350-
351348
class UnknownMethodAliasError < DefinitionError
352349
include DetailedMessageable
353350

sig/errors.rbs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,9 @@ module RBS
193193
end
194194

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

199198
class ClassInstanceVariableDuplicationError < VariableDuplicationError
200-
def self.check!: (variables: Hash[Symbol, Definition::Variable], member: AST::Members::ClassInstanceVariable, type_name: TypeName) -> void
201-
end
202-
203-
class ClassVariableDuplicationError < VariableDuplicationError
204-
def self.check!: (variables: Hash[Symbol, Definition::Variable], member: AST::Members::ClassVariable, type_name: TypeName) -> void
205199
end
206200

207201
# The `alias` member declares an alias from unknown method

test/rbs/definition_builder_test.rb

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2838,11 +2838,6 @@ class ClassInstanceVariable
28382838
self.@class_instance: Integer
28392839
self.@class_instance: Integer
28402840
end
2841-
2842-
class ClassVariable
2843-
@@class: Integer
2844-
@@class: Integer
2845-
end
28462841
EOF
28472842

28482843
manager.build do |env|
@@ -2866,34 +2861,6 @@ class ClassVariable
28662861
assert_raises(RBS::ClassInstanceVariableDuplicationError) do
28672862
builder.build_singleton(type_name("::ClassInstanceVariable"))
28682863
end
2869-
assert_raises(RBS::ClassVariableDuplicationError) do
2870-
builder.build_instance(type_name("::ClassVariable"))
2871-
end
2872-
end
2873-
end
2874-
2875-
SignatureManager.new do |manager|
2876-
manager.add_file("inherited.rbs", <<-EOF)
2877-
class A
2878-
@instance: Integer
2879-
self.@class_instance: Integer
2880-
@@class: Integer
2881-
end
2882-
2883-
class B < A
2884-
@instance: Integer
2885-
self.@class_instance: Integer
2886-
@@class: Integer
2887-
end
2888-
EOF
2889-
2890-
manager.build do |env|
2891-
builder = DefinitionBuilder.new(env: env)
2892-
2893-
builder.build_instance(type_name("::A"))
2894-
assert_raises(RBS::ClassVariableDuplicationError) do
2895-
builder.build_instance(type_name("::B"))
2896-
end
28972864
end
28982865
end
28992866
end

0 commit comments

Comments
 (0)