diff --git a/lib/rbs/errors.rb b/lib/rbs/errors.rb index b07a792f6..c68f6814c 100644 --- a/lib/rbs/errors.rb +++ b/lib/rbs/errors.rb @@ -580,11 +580,13 @@ def initialize(message, location:) class TypeParamDefaultReferenceError < DefinitionError include DetailedMessageable + attr_reader :type_param attr_reader :location def initialize(type_param, location:) super "#{Location.to_string(location)}: the default of #{type_param.name} cannot include optional type parameter" @location = location + @type_param = type_param end def self.check!(type_params) diff --git a/sig/errors.rbs b/sig/errors.rbs index e83f51bf7..6f98fe4be 100644 --- a/sig/errors.rbs +++ b/sig/errors.rbs @@ -372,6 +372,8 @@ module RBS class TypeParamDefaultReferenceError < BaseError include DetailedMessageable + attr_reader type_param: AST::TypeParam + def initialize: (AST::TypeParam, location: Location[untyped, untyped]?) -> void attr_reader location: Location[untyped, untyped]?