未验证 提交 b2bb725c 编写于 作者: S Steffen Forkmann 提交者: GitHub

Use distinctBy instead of noRepeats (#9104)

* Use distinctBy instead of noRepeats

* Use distinctBy instead of noRepeats
上级 f780dc5d
......@@ -706,7 +706,7 @@ let FlatEnvPacks g fclassM topValS declist (reqdItemsMap: Zmap<BindingGroupShari
// determine vals(env) - transclosure
let vals = env.ReqdVals @ List.collect valsSubEnvFor env.ReqdSubEnvs // list, with repeats
let vals = List.noRepeats valOrder vals // noRepeats
let vals = vals |> List.distinctBy (fun v -> v.Stamp)
// Remove genuinely toplevel, no need to close over these
let vals = vals |> List.filter (IsMandatoryTopLevel >> not)
......
......@@ -457,9 +457,9 @@ type CalledMeth<'T>
| _ ->
Choice2Of2(arg))
let names = namedCallerArgs |> List.map (fun (CallerNamedArg(nm, _)) -> nm.idText)
let names = namedCallerArgs |> List.distinctBy (fun (CallerNamedArg(nm, _)) -> nm.idText)
if (List.noRepeats String.order names).Length <> namedCallerArgs.Length then
if names.Length <> namedCallerArgs.Length then
errorR(Error(FSComp.SR.typrelNamedArgumentHasBeenAssignedMoreThenOnce(), m))
let argSet = { UnnamedCalledArgs=unnamedCalledArgs; UnnamedCallerArgs=unnamedCallerArgs; ParamArrayCalledArgOpt=paramArrayCalledArgOpt; ParamArrayCallerArgs=paramArrayCallerArgs; AssignedNamedArgs=assignedNamedArgs }
......
......@@ -267,11 +267,6 @@ let mapTriple (f1, f2, f3) (a1, a2, a3) = (f1 a1, f2 a2, f3 a3)
let mapQuadruple (f1, f2, f3, f4) (a1, a2, a3, a4) = (f1 a1, f2 a2, f3 a3, f4 a4)
let fmap2Of2 f z (a1, a2) = let z, a2 = f z a2 in z, (a1, a2)
module List =
let noRepeats xOrder xs =
let s = Zset.addList xs (Zset.empty xOrder) // build set
Zset.elements s // get elements... no repeats
//---------------------------------------------------------------------------
// Zmap rebinds
//-------------------------------------------------------------------------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册