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 resolution in script file doesn't work for type provider without qualified names #13887

Closed
smoothdeveloper opened this issue Sep 12, 2022 · 2 comments

Comments

@smoothdeveloper
Copy link
Contributor

Repro steps
Setting "Use .NET Core Scripting" to False:

image

I'm facing situation with a script such as:

#r "nuget: FSharp.Data"
open FSharp.Data
type J = JsonProvider< """{ "a":"b", "c": 1}""">
type JQualified = FSharp.Data.JsonProvider< """{ "a":"b", "c": 1}""">

the first JsonProvider shows squiggles

FS00039: The type JsonProvider is not defined.

It doesn't happen with "Use .NET Core Scripting" to True.

It doesn't affect fsianycpu.exe evaluation but just the tooling.

Actual behavior

the first JsonProvider shows squiggles

FS00039: The type JsonProvider is not defined.

image

Expected behavior

It should work disregarding the setting.

Known workarounds

Using qualified names, which is a bit problematic.

Related information

  • Windows 11 Pro 22H2 22622.590
  • VS 2022 17.2.6
@dsyme
Copy link
Contributor

dsyme commented Sep 23, 2022

To use FSharp.Data with .NET 4.7.2 you must reference System.Xml.Linq in scripts:

#r "nuget: FSharp.Data, 5.0.2"
#r "System.Xml.Linq"
open FSharp.Data
type J = JsonProvider< """{ "a":"b", "c": 1}""">
type JQualified = FSharp.Data.JsonProvider< """{ "a":"b", "c": 1}""">

@dsyme dsyme closed this as completed Sep 23, 2022
Repository owner moved this from Not Planned to Done in F# Compiler and Tooling Sep 23, 2022
@smoothdeveloper
Copy link
Contributor Author

Thanks @dsyme, there is still an issue, IMO:

  • if System.Xml.Linq was required, the qualified instantiation should also fail
  • user can't figure there would be a dependency missing
  • it only impacts the tooling, fsianycpu is 100% fine without the extra reference

What can be done to improve the situation? I feel the squiggle should actually surface the missing dependency, if that's the actual issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants