File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1173,6 +1173,15 @@ let AdjustCallerArgForOptional tcFieldInit eCallerMemberName (infoReader: InfoRe
11731173 if isOptCallerArg then errorR( Error( FSComp.SR.tcFormalArgumentIsNotOptional(), m))
11741174 assignedArg
11751175
1176+ // For non-nullable, non-optional arguments no conversion is needed.
1177+ // We return precisely the assignedArg. This also covers the case where there
1178+ // can be a lingering permitted type mismatch between caller argument and called argument,
1179+ // specifically caller can by `byref` and called `outref`. No coercion is inserted in the
1180+ // expression tree in this case.
1181+ | NotOptional when not ( isNullableTy g calledArgTy) ->
1182+ if isOptCallerArg then errorR( Error( FSComp.SR.tcFormalArgumentIsNotOptional(), m))
1183+ assignedArg
1184+
11761185 | _ ->
11771186
11781187 let callerArgExpr2 =
@@ -1183,7 +1192,7 @@ let AdjustCallerArgForOptional tcFieldInit eCallerMemberName (infoReader: InfoRe
11831192 if isNullableTy g calledArgTy then
11841193 MakeNullableExprIfNeeded infoReader calledArgTy callerArgTy callerArgExpr m
11851194 else
1186- callerArgExpr
1195+ failwith " unreachable " // see case above
11871196
11881197 | CallerSide dfltVal ->
11891198 let calledArgTy = calledArg.CalledArgumentType
You can’t perform that action at this time.
0 commit comments