Open anovstrup opened 4 years ago
I just realized that I had messed up the original bug report. The name of the definition must be qualified with the type name (i.e., A.Foo x = 3
not Foo x = 3
) in order to trigger the bug. I've edited the description accordingly.
Transcript here: https://gist.github.com/anovstrup/1123c4fa24d0ca9c85ec73ee0fc8e09b
Hm, I added the typechecker
label then removed cause I'm now unsure. I think it may just be HandleInput
code forgetting about this case (two terms with the same name, one a Con
and one a Ref
):
doTerm :: v -> (Path, Branch0 m -> Branch0 m)
doTerm v = case toList (Names.termsNamed names (Name.fromVar v)) of
[] -> errorMissingVar v
[r] -> case Path.splitFromName (Name.fromVar v) of
Nothing -> errorEmptyVar
Just split -> BranchUtil.makeAddTermName split r (md v)
wha -> error $ "Unison bug, typechecked file w/ multiple terms named "
<> Var.nameStr v <> ": " <> show wha
...otoh it does seem awful similar to the DuplicateDeclarations
error emitted by the type checker. And you probably don't want to have these two conflicting names added...
Observed in M1g. To reproduce, add these definitions to a scratch file and then run the
add
command:Unison exits with