diff --git a/ext/rbs_extension/parser.c b/ext/rbs_extension/parser.c index c5a263a48..ad230e3f0 100644 --- a/ext/rbs_extension/parser.c +++ b/ext/rbs_extension/parser.c @@ -503,6 +503,7 @@ static void parse_params(parserstate *state, method_params *params) { case tUIDENT: case tLIDENT: + case tQIDENT: case tULIDENT: case tULLIDENT: case tBANGIDENT: diff --git a/test/rbs/parser_test.rb b/test/rbs/parser_test.rb index 07d3ed932..31b6dc2e9 100644 --- a/test/rbs/parser_test.rb +++ b/test/rbs/parser_test.rb @@ -626,6 +626,14 @@ def test_parse_method_type assert_equal "?foo, ?foo: String", method_type.type.param_to_s end + RBS::Parser.parse_method_type(buffer("(`foo`: String) -> void")).tap do |method_type| + assert_equal "`foo`: String", method_type.type.param_to_s + end + + RBS::Parser.parse_method_type(buffer("(?`foo`: String) -> void")).tap do |method_type| + assert_equal "?`foo`: String", method_type.type.param_to_s + end + RBS::Parser.parse_method_type(buffer("(1) -> void")).tap do |method_type| assert_equal "1", method_type.type.param_to_s end diff --git a/test/rbs/types_test.rb b/test/rbs/types_test.rb index 9564ca731..60b4d9777 100644 --- a/test/rbs/types_test.rb +++ b/test/rbs/types_test.rb @@ -31,6 +31,7 @@ def test_to_s assert_equal "(^() -> void)?", parse_type("(^() -> void)?").to_s assert_equal "^(bool flag, ?untyped, *Symbol, name: String, ?email: nil, **Symbol) -> void", parse_type("^(bool flag, ?untyped, *Symbol, name: String, ?email: nil, **Symbol) -> void").to_s assert_equal "^(untyped untyped, untyped footype) -> void", parse_type("^(untyped `untyped`, untyped footype) -> void").to_s + assert_equal "^(`foo`: untyped) -> void", parse_type("^(`foo`: untyped) -> void").to_s end def test_has_self_type?