Skip to content

ResolutionFolder=__SOURCE_DIRECTORY__ broken between dotnet 5.0.203 and 5.0.300 #1384

@graydon

Description

@graydon

With a random json file t.json in the current working directory, the following file works on dotnet 5.0.203:

#r "nuget: FSharp.Data"
open FSharp.Data
type t = JsonProvider<"t.json", ResolutionFolder=__SOURCE_DIRECTORY__>

On dotnet 5.0.300 it fails with the following message:

bad.fsx(3,50): error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.

It can be worked around with the following:

#r "nuget: FSharp.Data"
open FSharp.Data
[<Literal>]
let path = __SOURCE_DIRECTORY__ + "/t.json"
type t = JsonProvider<path>

or

#r "nuget: FSharp.Data"
open FSharp.Data
[<Literal>]
let dir = __SOURCE_DIRECTORY__
type t = JsonProvider<"t.json", ResolutionFolder=dir>

So my guess is that __SOURCE_DIRECTORY__ was implicitly marked as [<Literal>] in 5.0.203 but no longer in 5.0.300; in any case the first test is what the docs use as examples and it no longer works, so something should probably be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions