-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix code navigation for enum values (#220)
With this patch, we reduce divergence from Sorbet by using a zero-length location for the synthetic classes generated when rewriting enums. We also add a special case for emitting definitions for enum values, since I wasn't able to figure out a better way to do the same thing.
- Loading branch information
1 parent
19514c6
commit af8a120
Showing
5 changed files
with
90 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
# typed: struct | ||
# typed: strict | ||
|
||
class X < T::Enum | ||
enums do | ||
A = new("A") | ||
B = new | ||
C = B | ||
end | ||
|
||
All = T.let([A, B], T::Array[X]) | ||
end | ||
|
||
# Adding more cases like this is not supported (c.f. isTEnum), | ||
# but let's at least add a test. | ||
class Y < X | ||
enums do | ||
D = new | ||
E = B | ||
end | ||
end | ||
|
||
def use_abc | ||
x = X::A | ||
return | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters