-
Notifications
You must be signed in to change notification settings - Fork 854
Open
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingArea-Compiler-Checking-AttributesAttribute targets, AllowMultiple, CompiledName, custom attribute encodingAttribute targets, AllowMultiple, CompiledName, custom attribute encodingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Description
There is an internal compiler error when you use a custom attribute and omit an optional argument tagged with System.Runtime.InteropServices.OptionalAttribute
Repro steps
module TestCase
open System
open System.Runtime.InteropServices
type FooAttribute(foo : string, bar : bool) =
inherit Attribute()
new([<Optional>] bar) = FooAttribute("", bar)
[<Foo>]
type Bar() = class endExpected behavior
This should compile
Actual behavior
TestCase.fs(10,3): error FS0073: internal error: The type 'System.Boolean' may not be used as a custom attribute value
Known workarounds
Add a DefaultParameterValue attribute.
Related information
Provide any related information (optional):
- Mac OS 10.15.1
- Mono JIT compiler version 6.6.0.155 (2019-08/296a9afdb24 Thu Nov 14 06:12:25 EST 2019)
- Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingArea-Compiler-Checking-AttributesAttribute targets, AllowMultiple, CompiledName, custom attribute encodingAttribute targets, AllowMultiple, CompiledName, custom attribute encodingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Type
Projects
Status
New