Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.1
-
None
-
None
Description
import groovy.transform.* class Expr {} class VarExpr extends Expr {} class TupList { TupList(Expr e1) {} TupList(Expr[] es) {} } class ArgList extends TupList { ArgList(Expr e1) { super(e1) } ArgList(Expr[] es) { super(es) } } @TypeChecked class Bug4 { void test() { new ArgList(new VarExpr()) } } new Bug4().test()
Yields:
[Static type checking] - Reference to method is ambiguous. Cannot choose between [MethodNode@745724997[void <init>(Expr)], MethodNode@685460687[void <init>(Expr[])]] at line: 19, column: 9
It's happening somehow because VarExpr is a child of Expr.
In the case of just creating and passing an Expr, things are fine.