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

Commitc5482ca

Browse files
forkiKevinRansom
authored andcommitted
Use a HashSet instead of dict and do only one lookup (#3160)
1 parent3408b46 commitc5482ca

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

‎src/fsharp/TypeChecker.fs‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10005,18 +10005,16 @@ and bindLetRec (binds:Bindings) m e =
1000510005

1000610006
/// Check for duplicate bindings in simple recursive patterns
1000710007
and CheckRecursiveBindingIds binds =
10008-
let hashOfBinds = newDictionary<string,_>()
10008+
let hashOfBinds = newHashSet<string>()
1000910009

1001010010
for (SynBinding.Binding(_,_,_,_,_,_,_,b,_,_,m,_)) in binds do
1001110011
let nm =
1001210012
match b with
1001310013
| SynPat.Named(_,id,_,_,_) -> id.idText
1001410014
| SynPat.LongIdent(LongIdentWithDots([id],_),_,_,_,_,_) -> id.idText
1001510015
| _ -> ""
10016-
if nm <> "" then
10017-
if hashOfBinds.ContainsKey(nm) then
10018-
error(Duplicate("value",nm,m))
10019-
else hashOfBinds.[nm] <- b
10016+
if nm <> "" && not (hashOfBinds.Add nm) then
10017+
error(Duplicate("value",nm,m))
1002010018

1002110019
/// Process a sequence of sequentials mixed with iterated lets "let ... in let ... in ..." in a tail recursive way
1002210020
/// This avoids stack overflow on really large "let" and "letrec" lists

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp