-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Regex features in raw-string-literals. #65838
Conversation
void Goo() | ||
{ | ||
var r = new Regex(""" | ||
$$ (a)\0\1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this previously would crash in highlight refs.
{ | ||
void goo() | ||
{ | ||
var r = new Regex("""$$ """); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this case would previously assert, but not crash.
// that is relevant is the \ character, and it's only relevant if we insert into | ||
// a normal string and not a verbatim string. There are no other regex characters | ||
// that completion will produce that need any escaping. | ||
Debug.Assert(token.Kind() == SyntaxKind.StringLiteralToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bogus assert.
// Characters can be discontiguous (for example, in multi-line-raw-string literals). So if the | ||
// position is in one of the gaps, it won't be able to find a corresponding virtual char. | ||
if (index < 0) | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actual crash fix.
Fixes #65836