-
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 null ref in initialize-parameter. #18487
Fix null ref in initialize-parameter. #18487
Conversation
Tagging @dotnet/roslyn-ide @jmarolf |
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.
👍
Shouldn't that be getting an EndOfFile token with the parent as the compilation syntax? |
GetPreviousToken on an EOF token can return a .None token with a null parent. I considered this when i originally wrote the code. but i thought FirstAncestorOrSelf was an extension method and would handle the 'null' case (like IsKind and many of the other node-extension methods do). It turned out this was an instance method. Hence boom. |
All the more reason to hate extension methods that accept null receivers. 😉 |
i love them! :D |
though, with ?. they're probably not necessary any more. |
@mattwar probably still gets flashbacks from when he changed all those extension methods to instance methods and discovered that all if them just returned null if passed null |
There's a part of me that would be happy to see a change where everything did ?. But the bug fallout and massive diff would be crazy... |
The only case for that is an empty file, right? |
sure would be nice to have null checking compiler. |
Or any file when you're on the first token. |
Ah, got it. I was confused by the reference to EOF token before. |
No description provided.