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

"Type mismatch when building 'expr'" error on quotations #333

Closed
Jand42 opened this issue Feb 25, 2020 · 3 comments
Closed

"Type mismatch when building 'expr'" error on quotations #333

Jand42 opened this issue Feb 25, 2020 · 3 comments

Comments

@Jand42
Copy link
Contributor

Jand42 commented Feb 25, 2020

Description

The F# compiler can give a Type mismatch when building 'expr' error on two types which should be the same during the running of a TP.
Found when building https://github.com/dotnet-websharper/ui and this is a breaking change introduced by #332, works with the previous state (e9d2c93).

Example of error:

 The type provider 'WebSharper.UI.Templating.TemplatingProvider' reported an error in the context of provided type 'WebSharper.UI.Templating.Template,pathOrHtml="index.html,template.html",clientLoad="2",legacyMode="3"+template', member 'NewDescription'. The error: Type mismatch when building 'expr': the expression has the wrong type. Expected 'WebSharper.UI.Var`1[System.String]', but received type 'WebSharper.UI.Var`1[System.String]'.�Parameter name: receivedType

The WebSharper.UI.Templating type provider uses expression splicing extensively, probably the issue is related to that, I am experimenting to find a minimal failing test case and will update this description if found.

Repro steps

Expected behavior

WebSharper.UI.Templating.Tests project should build as before, now fails on erased TP use.

Actual behavior

Build errors.

Known workarounds

Use earlier state of FSharp.TypeProviders.SDK.

Related information

  • Operating system: Win10Pro 64bit
  • Branch: master
  • .NET Runtime, CoreCLR or Mono Version: .NET Framework 4.6.1, .NET Standard 2.0
@sergey-tihon
Copy link
Member

sergey-tihon commented Feb 25, 2020

cc @thinkbeforecoding

@thinkbeforecoding
Copy link
Contributor

#332 was actually done to build methods that have parameters or return types that are RuntimeType generics (like Task<'t> or Async<'t>) of generated type.
Previously, the handling of method parameters used t.MakeGeneric which returns such generic that doesn't work then for generation.. I may have broken your usecase in the process.
A repro would ease the fix

@thinkbeforecoding
Copy link
Contributor

thinkbeforecoding commented Mar 11, 2020

I tested your sample with this fix from #335 and it now seems to work correctly 👍

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

No branches or pull requests

3 participants