Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitccf2cf5

Browse files
forkiKevinRansom
authored andcommitted
Map lookup only once (dotnet#2270)
1 parentccdfae0 commitccf2cf5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎src/fsharp/TypeChecker.fs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5395,10 +5395,9 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv,names,takenNames) ty pat
53955395
let ftys = fields |> List.map (fun fsp -> actualTyOfRecdField inst fsp,fsp)
53965396
let fldsmap',acc =
53975397
((tpenv,names,takenNames), ftys) ||> List.mapFold (fun s (ty,fsp) ->
5398-
if Map.containsKey fsp.rfield_id.idText fldsmap then
5399-
TcPat warnOnUpper cenv env None vFlags s ty (Map.find fsp.rfield_id.idText fldsmap)
5400-
else
5401-
(fun _ -> TPat_wild m),s)
5398+
match Map.tryFind fsp.rfield_id.idText fldsmap with
5399+
| Some v -> TcPat warnOnUpper cenv env None vFlags s ty v
5400+
| None -> (fun _ -> TPat_wild m),s)
54025401
(fun values -> TPat_recd (tcref,tinst,List.map (fun f -> f values) fldsmap',m)),
54035402
acc
54045403

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp