fuzion
fuzion copied to clipboard
confusing error: Ambiguous call targets found for call
> cat test.fz
test is
"{ for a := marray 100 false, a until (true) (1..2) |& (i -> !a[i])}"
> ./build/bin/fz test
java.lang.Error: check-condition failed!
at dev.flang.util.ANY.check(ANY.java:371)
at dev.flang.ast.Feature$FeaturesAndOuter.filter(Feature.java:2979)
at dev.flang.ast.Call.loadCalledFeature(Call.java:737)
at dev.flang.ast.Call.resolveTypes(Call.java:1337)
at dev.flang.ast.Feature$ResolveTypes.action(Feature.java:1361)
at dev.flang.ast.Feature$ResolveTypes.action(Feature.java:1353)
at dev.flang.ast.Call.visit(Call.java:895)
at dev.flang.ast.Call.visit(Call.java:893)
at dev.flang.ast.Call.visit(Call.java:893)
at dev.flang.ast.Call.visit(Call.java:49)
at dev.flang.ast.Block.visit(Block.java:214)
at dev.flang.ast.Block.visit(Block.java:41)
at dev.flang.ast.Impl.visit(Impl.java:316)
at dev.flang.ast.Feature.visit(Feature.java:1097)
at dev.flang.ast.Feature.resolveTypes(Feature.java:1408)
at dev.flang.ast.Resolution.resolveOne(Resolution.java:411)
at dev.flang.ast.Resolution.resolveTypes(Resolution.java:369)
at dev.flang.ast.Expr.addFieldForResult(Expr.java:266)
at dev.flang.ast.If.propagateExpectedType(If.java:379)
at dev.flang.ast.Block.propagateExpectedType(Block.java:423)
at dev.flang.ast.Impl.propagateExpectedType(Impl.java:362)
at dev.flang.ast.Feature$7.action(Feature.java:1777)
at dev.flang.ast.Impl.visit(Impl.java:325)
at dev.flang.ast.Feature.visit(Feature.java:1097)
at dev.flang.ast.Feature.typeInference(Feature.java:1773)
at dev.flang.ast.Feature.typeInference(Feature.java:1752)
at dev.flang.ast.Resolution.resolveOne(Resolution.java:425)
at dev.flang.ast.Resolution.resolve(Resolution.java:378)
at dev.flang.ast.Resolution.<init>(Resolution.java:216)
at dev.flang.fe.FrontEnd.createMIR(FrontEnd.java:155)
at dev.flang.tools.Fuzion.lambda$parseArgsForBackend$3(Fuzion.java:471)
at dev.flang.tools.Tool.run(Tool.java:166)
at dev.flang.tools.Fuzion.main(Fuzion.java:209)
Here is a smaller example that causes this problem:
test is
for a := 3 until true
1..2 | i -> a
@fridis seems to be resolved. I can not reproduce the crash anymore.
But I see a new confusing error now:
> ./build/bin/fz test102.fz
/home/fridi/fuzion/work/test102.fz:3:17: error 1: Ambiguous call targets found for call to 'a' (no arguments)
1..2 | i -> a
----------------^
Found several possible targets that match this call:
'test.#loop0.a' defined at /home/fridi/fuzion/work/test102.fz:2:7:
for a := 3 until true
------^
and 'test.#loop0.a' defined at /home/fridi/fuzion/work/test102.fz:2:7:
for a := 3 until true
------^
one error.
already fixed as well as reg-test merged.