-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 type name parsing in NativeAOT #79963
Fix type name parsing in NativeAOT #79963
Conversation
Simplified type name parsing was breaking if full name or assembly name has underscode ('_') in it. That breaks referencing `SQLitePCL.Batteries_V2, SQLitePCLRaw.batteries_v2` type inside `Microsoft.Data.Sqlite` Fixes dotnet/efcore#29725
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsSimplified type name parsing was breaking if full name or assembly name has underscode ('_') in it. That breaks referencing Fixes dotnet/efcore#29725
|
@@ -23,7 +23,7 @@ public static bool ResolveType(string name, ModuleDesc callingModule, TypeSystem | |||
StringBuilder typeName = new StringBuilder(); | |||
StringBuilder typeNamespace = new StringBuilder(); | |||
string containingTypeName = null; | |||
while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '`' || name[i] == '+')) | |||
while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '_' || name[i] == '`' || name[i] == '+')) |
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.
Not sure what the style conventions are in the compiler, but you could simplify this with a pattern if that's allowed?
while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '_' || name[i] == '`' || name[i] == '+')) | |
while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] is '.' or '_' or '`' or '+')) |
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.
No need to polish this; this file will be nuked from orbit with #72833. This parser is kind of garbage. It's from a time when this being a heuristic was enough, as the comment above says. That time has passed.
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.
Thank you!
@@ -23,7 +23,7 @@ public static bool ResolveType(string name, ModuleDesc callingModule, TypeSystem | |||
StringBuilder typeName = new StringBuilder(); | |||
StringBuilder typeNamespace = new StringBuilder(); | |||
string containingTypeName = null; | |||
while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '`' || name[i] == '+')) | |||
while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '_' || name[i] == '`' || name[i] == '+')) |
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.
No need to polish this; this file will be nuked from orbit with #72833. This parser is kind of garbage. It's from a time when this being a heuristic was enough, as the comment above says. That time has passed.
Simplified type name parsing was breaking if full name or assembly name has underscode ('_') in it. That breaks referencing
SQLitePCL.Batteries_V2, SQLitePCLRaw.batteries_v2
type insideMicrosoft.Data.Sqlite
Fixes dotnet/efcore#29725