-
-
Notifications
You must be signed in to change notification settings - Fork 922
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Truffle] Fixed String#[](Regexp, int).
When calling String#[] with a Regexp and a negative index, the negative index can't normalize to 0. Whereas that is valid for MatchData#[], in String#[] it should return nil(). This case in especially annoying because the 'capture' parameter can be any Object that responds to either to_int or to_sym. Handling all these coercion cases in Java is incredibly verbose, so I opted to execute a Ruby snippet equivalent to what Rubinius would have done.
- Loading branch information
Showing
2 changed files
with
2 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
fails:String#[] with Range calls to_int on range arguments | ||
fails:String#[] with Range works with Range subclasses | ||
fails:String#[] with Regexp, index returns nil if there is no capture for the given index |
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