Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9891 from som-snytt/issue/7212
Prefer type of overridden member when inferring (under `-Xsource:3`)
- Loading branch information
Showing
5 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
// scalac: -Xsource:3 | ||
|
||
class A { | ||
def f: Option[String] = Some("hello, world") | ||
def remove(): Unit = () | ||
} | ||
class B extends A { | ||
override def f = None | ||
override def remove() = ??? | ||
} | ||
class C extends B { | ||
override def f: Option[String] = Some("goodbye, cruel world") | ||
override def remove(): Unit = println("removed! (not really)") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
public class JavaClient extends ScalaThing { | ||
public void remove() { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
public interface JavaThing { | ||
default void remove() { throw new UnsupportedOperationException(); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
// scalac: -Xsource:3 | ||
|
||
class ScalaThing extends JavaThing { | ||
override def remove() = ??? | ||
} |