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 name-demangleling of provided types #102

Closed
wants to merge 5 commits into from
Closed

Conversation

forki
Copy link
Contributor

@forki forki commented Jan 25, 2015

This fixes #98

As reported in #98 the mangleling routine removes parameters which match the default value from the typeLogicalName. If all parameters match their default value we have a mangled name like typeName, which is also reported:

image

I created a couple of unittests which pin the current behaviour. In order to do so I extracted the mangleling routine to make it testable.
I then added a testcase which tries to demangle "MyNamespace.Test," and fails.

The last commit uses the strategy @vladima suggested in #98 and fixes the test case.

I think this will work fine, but I wonder if we should fix https://github.com/Microsoft/visualfsharp/blob/fsharp4/src/fsharp/PrettyNaming.fs#L466 instead and just don't generate logical type names with trailing ,.

@forki
Copy link
Contributor Author

forki commented Jan 25, 2015

I also wonder if this is the right place for the tests.

@forki
Copy link
Contributor Author

forki commented Jan 27, 2015

I still think it would be better to not let the strange logical names happen in the first place.
@dsyme what do you think?

@@ -65,6 +65,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="NUnitFrameworkShims.fs" Condition="'$(TargetFramework)' == 'sl3-wp'" />
<Compile Include="ManglelingNameOfProvidedTypes.fs" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Proper spelling is "mangling"

@latkin
Copy link
Contributor

latkin commented Feb 3, 2015

Looks nice. Just a couple cleanup suggestions.

@forki
Copy link
Contributor Author

forki commented Feb 3, 2015

There is still the question if this is the right fix.
Personally I'd prefer to not let the strange identifiers happen. I think I'll send a second pull request with alternative fix

@forki
Copy link
Contributor Author

forki commented Feb 3, 2015

see #203 for the second approach.

@forki
Copy link
Contributor Author

forki commented Feb 4, 2015

closing this in favor of #203

@forki forki closed this Feb 4, 2015
latkin pushed a commit that referenced this pull request Feb 5, 2015
fixes #102
closes #203

commit 6cc3227
Author: Steffen Forkmann <[email protected]>
Date:   Tue Feb 3 15:30:23 2015 +0100

    Do not generate logical type names like "MyNamespace.Test,"

commit b40d937
Author: Steffen Forkmann <[email protected]>
Date:   Sun Jan 25 15:08:36 2015 +0100

    Fix demangling of provided types with only default values - fixes #98

commit 515501a
Author: Steffen Forkmann <[email protected]>
Date:   Sun Jan 25 14:56:45 2015 +0100

    Create test case for #98

commit 5569580
Author: Steffen Forkmann <[email protected]>
Date:   Sun Jan 25 14:50:04 2015 +0100

    Added some tests to describe current behaviour of NameMangling of provided types

commit be2d157
Author: Steffen Forkmann <[email protected]>
Date:   Sun Jan 25 14:22:49 2015 +0100

    Extract computeMangledNameWithoutDefaultArgValues to make it testable

commit bbdd2a3
Author: Steffen Forkmann <[email protected]>
Date:   Sun Jan 25 13:13:00 2015 +0100

    Cleanup: removed commented code which uses deleted functions
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.

2 participants