Skip to content

Commit 716fa60

Browse files
authored
Merge pull request #1997 from ksss/default_type_range
Fix position for default_type
2 parents ffea4f6 + c903b63 commit 716fa60

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

ext/rbs_extension/parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ VALUE parse_type_params(parserstate *state, range *rg, bool module_type_params)
11941194

11951195
default_type_range.start = state->current_token.range.start;
11961196
default_type = parse_type(state);
1197-
default_type_range.start = state->current_token.range.end;
1197+
default_type_range.end = state->current_token.range.end;
11981198

11991199
required_param_allowed = false;
12001200
} else {

test/rbs/signature_parsing_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,6 +2061,7 @@ class Foo[X < _Each[String]? = Array[String]]
20612061
assert_equal :invariant, param.variance
20622062
refute_predicate param, :unchecked?
20632063
assert_nil param.upper_bound
2064+
assert_equal 29...44, param.location[:default].range
20642065
assert_equal parse_type("_Each[String]?"), param.upper_bound_type
20652066
assert_equal parse_type("Array[String]"), param.default_type
20662067
end

0 commit comments

Comments
 (0)