Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: X10 2.2
-
Fix Version/s: X10 2.3.2
-
Component/s: X10 Compiler: Front-end Error Messages
-
Labels:None
-
Number of attachments :
Description
import x10.compiler.*; class Dood { static class IDed { protected static val counts = [0 as Int,0]; val id: Float; public def this(kind:Int) { this.id = this.count(kind); } @NoThisAccess def count(kind:Int) : Float = ++counts(kind % 2); public def toString() = "#" + id; } static class SubIDed extends IDed { protected static val subcounts = [0 as Int, 0, 0]; @NoThisAccess def count(kind:Int) : Float { val subcount <: Int = ++subcounts(kind % 3); // No super-access, so we end up replicating code (or something) val supercount <: Float = ++counts(kind % 2); return supercount + 1.0f / subcount; } } static def main(Array[String]){ for(k in 1..10) { val id <: IDed = new IDed(k); Console.OUT.println("k=" + k + "; id=" + id); } } }
The error message here is:
/Users/bard/x10/tmp/Dood.x10:12: No valid constructor found for Dood.IDed().
1 error.
A better error message might point out that some auto-generated code
(the SubIDed ctor) is trying to call some other auto-generated code
which isn't there. This is an admittedly tricky situation to explain in a
pithy one-line error message, but we might do better with:
/Users/bard/x10/tmp/Dood.x10:12: Automatically generated constructor Dood.SubIDed() calls super(), but the superclass Dood.IDed does not have a constructor that matches this call.
bulk defer of open issues to 2.2.2.