-
Notifications
You must be signed in to change notification settings - Fork 831
Closed
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.ReadyRegression
Milestone
Description
When using a provided type (e.g. HtmlProvider<Url>) in a type extension I get the following error:
FS0267 This is not a valid constant expression or custom attribute value
Seems to be a regression, this used to work with Visual Studio < 17.2.0 as far as I know.
Repro steps
Example project: Test.zip
module Test
open FSharp.Data
[<Literal>]
let url = "https://en.wikipedia.org/wiki/F_Sharp_(programming_language)"
// Works
let html = new HtmlProvider<url>()
type System.Object with
// Works
member x.Html = new HtmlProvider<"https://en.wikipedia.org/wiki/F_Sharp_(programming_language)">()
// Error: FS0267 This is not a valid constant expression or custom attribute value
member x.Html = new HtmlProvider<url>()Expected behavior
Should compile.
Actual behavior
Fails with error above.
Known workarounds
Use the literal directly as parameter.
- Windows 10
- .NET 6
- Visual Studio 17.2.2
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.ReadyRegression
Type
Projects
Status
Done