From 9fbf962b6eafd7b6d25ddf9c4472105b762d69cc Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 31 Jul 2024 14:30:43 +0200 Subject: [PATCH 1/2] Sink: report function domain type --- src/Compiler/Checking/Expressions/CheckExpressions.fs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 2b3d9e7f6c6..be64b075e2c 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -5755,8 +5755,8 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE | SynExpr.Match (spMatch, synInputExpr, synClauses, _m, _trivia) -> TcExprMatch cenv overallTy env tpenv synInputExpr spMatch synClauses - | SynExpr.MatchLambda (isExnMatch, mArg, clauses, spMatch, m) -> - TcExprMatchLambda cenv overallTy env tpenv (isExnMatch, mArg, clauses, spMatch, m) + | SynExpr.MatchLambda (isExnMatch, mFunction, clauses, spMatch, m) -> + TcExprMatchLambda cenv overallTy env tpenv (isExnMatch, mFunction, clauses, spMatch, m) | SynExpr.Assert (x, m) -> TcNonControlFlowExpr env <| fun env -> @@ -6009,12 +6009,13 @@ and TcExprMatch (cenv: cenv) overallTy env tpenv synInputExpr spMatch synClauses // <@ function x -> (x: int) @> // is // Lambda (_arg2, Let (x, _arg2, x)) -and TcExprMatchLambda (cenv: cenv) overallTy env tpenv (isExnMatch, mArg, clauses, spMatch, m) = +and TcExprMatchLambda (cenv: cenv) overallTy env tpenv (isExnMatch, mFunction, clauses, spMatch, m) = let domainTy, resultTy = UnifyFunctionType None cenv env.DisplayEnv m overallTy.Commit - let idv1, idve1 = mkCompGenLocal mArg (cenv.synArgNameGenerator.New()) domainTy + let idv1, idve1 = mkCompGenLocal mFunction (cenv.synArgNameGenerator.New()) domainTy + CallExprHasTypeSink cenv.tcSink (mFunction.StartRange, env.NameEnv, domainTy, env.AccessRights) let envinner = ExitFamilyRegion env let envinner = { envinner with eIsControlFlow = true } - let idv2, matchExpr, tpenv = TcAndPatternCompileMatchClauses m mArg (if isExnMatch then Throw else ThrowIncompleteMatchException) cenv None domainTy (MustConvertTo (false, resultTy)) envinner tpenv clauses + let idv2, matchExpr, tpenv = TcAndPatternCompileMatchClauses m mFunction (if isExnMatch then Throw else ThrowIncompleteMatchException) cenv None domainTy (MustConvertTo (false, resultTy)) envinner tpenv clauses let overallExpr = mkMultiLambda m [idv1] ((mkLet spMatch m idv2 idve1 matchExpr), resultTy) overallExpr, tpenv From 59eb8e9826226225c2bf4ef41f02fa4f400d3a19 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 31 Jul 2024 14:33:35 +0200 Subject: [PATCH 2/2] Release notes --- docs/release-notes/.FSharp.Compiler.Service/9.0.100.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md index c1ba8b4a6fc..172d864ed76 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md @@ -9,6 +9,7 @@ ### Added * Support for nullable reference types ([PR #15181](https://github.com/dotnet/fsharp/pull/15181)) +* Sink: report function domain type ([PR #17470](https://github.com/dotnet/fsharp/pull/17470)) ### Changed