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

Commit66af44b

Browse files
forkiKevinRansom
authored andcommitted
No need to setify fully (#4975)
1 parentcfffaff commit66af44b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

‎src/fsharp/TypeChecker.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ let ChooseCanonicalDeclaredTyparsAfterInference g denv declaredTypars m =
16311631

16321632
let declaredTypars = NormalizeDeclaredTyparsForEquiRecursiveInference g declaredTypars
16331633

1634-
if(ListSet.setify typarEq declaredTypars).Length <> declaredTypars.Length then
1634+
if ListSet.hasDuplicates typarEq declaredTypars then
16351635
errorR(Error(FSComp.SR.tcConstrainedTypeVariableCannotBeGeneralized(), m))
16361636

16371637
declaredTypars

‎src/fsharp/lib.fs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,23 @@ module ListSet =
230230
// Note: if duplicates appear, keep the ones toward the _front_ of the list
231231
letsetify f l= List.foldBack(insert f)(List.rev l)[]|> List.rev
232232

233+
lethasDuplicates f l=
234+
match lwith
235+
|[]->false
236+
|[_]->false
237+
|[x; y]-> f x y
238+
| x::rest->
239+
let recloop acc l=
240+
match lwith
241+
|[]->false
242+
| x::rest->
243+
if contains f x accthen
244+
true
245+
else
246+
loop(x::acc) rest
247+
248+
loop[x] rest
249+
233250
//-------------------------------------------------------------------------
234251
// Library: pairs
235252
//------------------------------------------------------------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp