Skip to content

Commit 6923e18

Browse files
committed
Expose missing constraints
1 parent 840eae8 commit 6923e18

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Compiler/Symbols/Symbols.fs

+5
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,11 @@ type FSharpGenericParameterConstraint(cenv, cx: TyparConstraint) =
15961596
| TyparConstraint.IsDelegate(ty1, ty2, _) -> FSharpGenericParameterDelegateConstraint(cenv, ty1, ty2)
15971597
| _ -> invalidOp "not a delegate constraint"
15981598

1599+
member _.AllowsRefStruct =
1600+
match cx with
1601+
| TyparConstraint.AllowsRefStruct _ -> true
1602+
| _ -> false
1603+
15991604
override x.ToString() = "<type constraint>"
16001605

16011606
type FSharpInlineAnnotation =

src/Compiler/Symbols/Symbols.fsi

+6
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,9 @@ type FSharpGenericParameterConstraint =
708708
/// Indicates a constraint that a type has a 'null' value
709709
member IsSupportsNullConstraint: bool
710710

711+
/// Indicates a constraint that a type doesn't support nullness
712+
member IsNotSupportsNullConstraint: bool
713+
711714
/// Indicates a constraint that a type supports F# generic comparison
712715
member IsComparisonConstraint: bool
713716

@@ -750,6 +753,9 @@ type FSharpGenericParameterConstraint =
750753
/// Gets further information about a delegate constraint
751754
member DelegateConstraintData: FSharpGenericParameterDelegateConstraint
752755

756+
/// An anti-constraint indicating that ref structs (e.g. Span<>) are allowed here
757+
member AllowsRefStruct: bool
758+
753759
[<RequireQualifiedAccess>]
754760
type FSharpInlineAnnotation =
755761

0 commit comments

Comments
 (0)