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

Specializing Operators.op_UnaryPlus for witness info #9769

Merged
merged 8 commits into from
Jul 25, 2020

Conversation

TIHan
Copy link
Contributor

@TIHan TIHan commented Jul 24, 2020

I got an internal compiler error when trying to compile one of the "hello world" test type providers under the preview flag. The error described that op_UnaryPlus had no witness info.

Upon investigation, we didn't add an UnaryPlusDynamic function to handle the witness info creation in TcGlobals.
Two ways to handle it:

  1. Add UnaryPlusDynamic public API so it will be picked up when looking for built-in witness infos
    or
  2. Specialize op_UnaryPlus call to id function for built-in witness info

@TIHan TIHan requested a review from dsyme July 24, 2020 02:33
Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

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

The change looks good but there is still a failure in the type provider test.

@TIHan
Copy link
Contributor Author

TIHan commented Jul 24, 2020

I think adding UnaryPlusDynamic is the right thing to do as it follows the current pattern. But, it does seem a little odd to create a new public API that just returns itself. Maybe there is a better way to do this without introducing a new public API.

@TIHan TIHan changed the title Added UnaryPlusDynamic for witness info Specializing op_UnaryPlus for witness info Jul 24, 2020
@TIHan
Copy link
Contributor Author

TIHan commented Jul 24, 2020

Ok, I managed to figure it out without adding to the public API. Basically, op_UnaryPlus will choose Operators.id for the witness info. I like this better versus having to add something to the public API that isn't necessary.

@TIHan TIHan changed the title Specializing op_UnaryPlus for witness info Specializing Operators.op_UnaryPlus for witness info Jul 24, 2020
@KevinRansom KevinRansom merged commit 87114ec into dotnet:master Jul 25, 2020
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
* Initial work to fix op_UnaryPlus witness info

* Added UnaryPlusDynamic

* update surface area

* Only enable type provider test on net472

* Removing UnaryPlusDynamic

* fixing build

* fix comment

* Update prim-types.fs
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.

3 participants