Skip to content

Commit d386098

Browse files
TIHanbaronfel
authored andcommitted
Fixed destNullableTy internal error (#8655)
* Fixed internal error for destNullableTy by removing rule for optional * Added test
1 parent f263e06 commit d386098

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/fsharp/MethodCalls.fs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ let AdjustCalledArgTypeForOptionals (g: TcGlobals) enforceNullableOptionalsKnown
189189
// CSharpMethod(x = arg), optional C#-style argument, may have type Nullable<ty>.
190190
// The arg should have type ty. However for backwards compat, we also allow arg to have type Nullable<ty>
191191
| CallerSide _ ->
192-
if isNullableTy g calledArgTy && g.langVersion.SupportsFeature LanguageFeature.NullableOptionalInterop then
192+
if isNullableTy g calledArgTy && g.langVersion.SupportsFeature LanguageFeature.NullableOptionalInterop then
193193
// If inference has worked out it's a nullable then use this
194194
if isNullableTy g callerArg.CallerArgumentType then
195195
calledArgTy
@@ -1186,11 +1186,6 @@ let AdjustCallerArgForOptional tcFieldInit eCallerMemberName (infoReader: InfoRe
11861186
let minfo = GetIntrinsicConstructorInfosOfType infoReader m calledArgTy |> List.head
11871187
let callerArgExprCoerced = mkCoerceIfNeeded g calledNonOptTy callerArgTy callerArgExpr
11881188
MakeMethInfoCall amap m minfo [] [callerArgExprCoerced]
1189-
elif isOptionTy g calledArgTy then
1190-
// CSharpMethod(x=b) when 'b' has nullable type and 'x' has optional type --> CSharpMethod(Some b.Value)
1191-
let calledNonOptTy = destOptionTy g calledArgTy
1192-
let callerArgExprCoerced = mkCoerceIfNeeded g calledNonOptTy callerArgTy callerArgExpr
1193-
mkSome g (destNullableTy g callerArgTy) callerArgExprCoerced m
11941189
else
11951190
// CSharpMethod(x=b) --> CSharpMethod(?x=b)
11961191
callerArgExpr

0 commit comments

Comments
 (0)