File tree 3 files changed +72
-2
lines changed
3 files changed +72
-2
lines changed Original file line number Diff line number Diff line change @@ -862,8 +862,14 @@ std::unique_ptr<parser::Node> Translator::translate(pm_node_t *node) {
862
862
case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE:
863
863
case PM_INTERPOLATED_SYMBOL_NODE:
864
864
case PM_INTERPOLATED_X_STRING_NODE:
865
- case PM_IT_LOCAL_VARIABLE_READ_NODE:
866
- case PM_IT_PARAMETERS_NODE:
865
+ case PM_IT_LOCAL_VARIABLE_READ_NODE: {
866
+ // See Prism::ParserStorage::ParsedRubyVersion
867
+ unreachable (" The `it` keyword was introduced in Ruby 3.4, which isn't supported by Sorbet yet." );
868
+ }
869
+ case PM_IT_PARAMETERS_NODE: {
870
+ // See Prism::ParserStorage::ParsedRubyVersion
871
+ unreachable (" The `it` keyword was introduced in Ruby 3.4, which isn't supported by Sorbet yet." );
872
+ }
867
873
case PM_LAMBDA_NODE:
868
874
case PM_MATCH_LAST_LINE_NODE:
869
875
case PM_MATCH_PREDICATE_NODE:
Original file line number Diff line number Diff line change
1
+ Begin {
2
+ stmts = [
3
+ Block {
4
+ send = Send {
5
+ receiver = Const {
6
+ scope = NULL
7
+ name = <C <U Proc>>
8
+ }
9
+ method = <U new>
10
+ args = [
11
+ ]
12
+ }
13
+ args = NULL
14
+ body = Send {
15
+ receiver = NULL
16
+ method = <U it>
17
+ args = [
18
+ ]
19
+ }
20
+ }
21
+ Block {
22
+ send = Send {
23
+ receiver = Const {
24
+ scope = NULL
25
+ name = <C <U Proc>>
26
+ }
27
+ method = <U new>
28
+ args = [
29
+ ]
30
+ }
31
+ args = NULL
32
+ body = Begin {
33
+ stmts = [
34
+ Assign {
35
+ lhs = LVarLhs {
36
+ name = <U it>
37
+ }
38
+ rhs = Integer {
39
+ val = "123"
40
+ }
41
+ }
42
+ LVar {
43
+ name = <U it>
44
+ }
45
+ ]
46
+ }
47
+ }
48
+ ]
49
+ }
Original file line number Diff line number Diff line change
1
+ # typed: false
2
+
3
+ # The `it` keyword was introduced in Ruby 3.4, which isn't supported by Sorbet yet.
4
+ # https://bugs.ruby-lang.org/issues/18980
5
+ #
6
+ # For now, we'll just treat it like a local variable read or method call.
7
+
8
+ Proc . new do
9
+ it # Prior to Ruby 3.4, this would just be a regular method call
10
+ end
11
+
12
+ Proc . new do
13
+ it = 123 # Prior to Ruby 3.4, this would just be a local variable write
14
+ it # ... and this is a local variable read.
15
+ end
You can’t perform that action at this time.
0 commit comments