Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sink: report function domain type #17470

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/9.0.100.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 6 additions & 5 deletions src/Compiler/Checking/Expressions/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down Expand Up @@ -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

Expand Down
Loading