Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: X10 2.1.2
-
Fix Version/s: None
-
Component/s: X10 Compiler: Front-end Typechecking
-
Labels:None
-
Number of attachments :
Description
class TestOverridingAndHasType {
class A {
def m():Int = 1;
def t():Int = 1;
def p():Double = 1;
}
class B extends A {
def m() {throw new Exception(); } // ShouldNotBeERR
def t() <: Int { throw new Exception(); } // ShouldNotBeERR ShouldNotBeERR
def p() = 2; // ShouldNotBeERR
}
class C {
def m() { throw new Exception(); } // infers void
def m1():void { throw new Exception(); }
def m2():Int { throw new Exception(); }
def m3() <: Int {throw new Exception(); } // ShouldNotBeERR
def m4() <: void {throw new Exception(); }
}
}
Issue Links
- duplicates
-
XTENLANG-1584
Inference should look at the method we are overriding.
-
- is depended upon by
-
XTENLANG-2584
X10 2.2 frontend issues (umbrella)
-
-
XTENLANG-2439
X10 2.2 language design decisions (umbrella)
-
- is related to
-
XTENLANG-2480
Type bounds do not play nice with coercions
-
Activity
Yoav Zibin
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
{code}
class TestOverridingAndHasType { class A { def m() = 1; def t() = 1; def p() = 1; } class B extends A { def m() {throw new Exception(); } // ShouldNotBeERR def t() <: Int { throw new Exception(); } // ShouldNotBeERR ShouldNotBeERR def p() = 2; // ShouldNotBeERR } class C { def m() { throw new Exception(); } // infers void def m1():void { throw new Exception(); } def m2():Int { throw new Exception(); } def m3() <: Int {throw new Exception(); } // ERR def m4() <: void {throw new Exception(); } } } {code} |
{code}
class TestOverridingAndHasType { class A { def m():Int = 1; def t():Int = 1; def p():Double = 1; } class B extends A { def m() {throw new Exception(); } // ShouldNotBeERR def t() <: Int { throw new Exception(); } // ShouldNotBeERR ShouldNotBeERR def p() = 2; // ShouldNotBeERR } class C { def m() { throw new Exception(); } // infers void def m1():void { throw new Exception(); } def m2():Int { throw new Exception(); } def m3() <: Int {throw new Exception(); } // ERR def m4() <: void {throw new Exception(); } } } {code} |
Yoav Zibin
made changes -
| Summary | When inferring the return type, we should consider overriding methods. | When inferring the return type, we should consider overriding methods and HasType. |
| Description |
{code}
class TestOverridingAndHasType { class A { def m():Int = 1; def t():Int = 1; def p():Double = 1; } class B extends A { def m() {throw new Exception(); } // ShouldNotBeERR def t() <: Int { throw new Exception(); } // ShouldNotBeERR ShouldNotBeERR def p() = 2; // ShouldNotBeERR } class C { def m() { throw new Exception(); } // infers void def m1():void { throw new Exception(); } def m2():Int { throw new Exception(); } def m3() <: Int {throw new Exception(); } // ERR def m4() <: void {throw new Exception(); } } } {code} |
{code}
class TestOverridingAndHasType { class A { def m():Int = 1; def t():Int = 1; def p():Double = 1; } class B extends A { def m() {throw new Exception(); } // ShouldNotBeERR def t() <: Int { throw new Exception(); } // ShouldNotBeERR ShouldNotBeERR def p() = 2; // ShouldNotBeERR } class C { def m() { throw new Exception(); } // infers void def m1():void { throw new Exception(); } def m2():Int { throw new Exception(); } def m3() <: Int {throw new Exception(); } // ShouldNotBeERR def m4() <: void {throw new Exception(); } } } {code} |
Igor Peshansky
made changes -
| Fix Version/s | X10 2.2 [ 16002 ] |
Igor Peshansky
made changes -
| Link | This issue is related to XTENLANG-2480 [ XTENLANG-2480 ] |
Igor Peshansky
made changes -
| Link |
This issue is depended upon by |
Igor Peshansky
made changes -
| Link |
This issue is depended upon by |
Igor Peshansky
made changes -
| Link | This issue duplicates XTENLANG-1584 [ XTENLANG-1584 ] |
Igor Peshansky
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | X10 2.2 [ 16002 ] | |
| Resolution | Duplicate [ 3 ] |
David Grove
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
This is a duplicate of XTENLANG-1584 (overriding methods) and XTENLANG-2480 (HasType).