Skip to content
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 for #270, and framework for testing cross-targeting scenarios #275

Closed
wants to merge 5 commits into from

Conversation

latkin
Copy link
Contributor

@latkin latkin commented Feb 26, 2015

ref #270 - "internal error: null: convTypeRefAux"

More issues with comma escaping, similar to #250. Fix is pretty simple, just replace , with \, in a couple more places that need it. Also needed some small logic to make sure we don't double-escape when depickling names that are already escaped.

This is risky mostly in multi-targeting scenarios: 4.0 compiler escapes type names differently than 3.X compiler -- can each understand the output of the other?

Added a general-purpose mini test framework for validating such things, which cycles through various cross-version scenarios and makes sure everything plays nicely.

@@ -324,25 +324,7 @@ type cenv =
// [ns] ,name -> ns+name
// [ns;typeA;typeB],name -> ns+typeA+typeB+name
let convTypeRefAux (cenv:cenv) (tref:ILTypeRef) =

// If an inner nested type's name contains a space, the proper encoding is "\+" on both sides - otherwise,
// we use "+"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell from my testing, this comment is just wrong -- I can't find any scenarios where the + is escaped. Indeed, the incorrect escaping needed to be removed in order to get my tests passing. All current tests continue to work fine.

This is now simplified and exactly matches https://github.com/Microsoft/visualfsharp/blob/fsharp4/src/absil/il.fs#L682

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That code had always been very, very suspect to me. Thanks for digging into this so thoroughly

@latkin
Copy link
Contributor Author

latkin commented Feb 27, 2015

For reference, some CLR code that pertains to parsing special chars in reflection-style type names (hooray open source 🎉)

https://github.com/dotnet/corefx/blob/dev/metadata/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Decoding/TypeNameParsing/TypeNameParserOfT.cs

https://github.com/dotnet/coreclr/blob/cbf46fb0b6a0b209ed1caf4a680910b383e68cba/src/vm/typeparse.h#L28

Of the designated reserved characters, only , is allowed in F# backticked type names (and none are allowed in C#/VB type names)

@KevinRansom
Copy link
Member

Looks good. Nice work.

@latkin latkin closed this in 0f00c2b Feb 27, 2015
@latkin latkin added the fixed label Feb 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants