forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add impl restriction related to invokespecial to Java parents
- Loading branch information
Showing
4 changed files
with
53 additions
and
2 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,4 @@ | ||
trait-defaults-super.scala:14: error: Implementation restriction: unable to emit a super call to java/lang/Iterable.spliterator from C. Add java/lang/Iterable as a direct parent of C | ||
class C extends T | ||
^ | ||
one error found |
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,21 @@ | ||
trait T extends java.lang.Iterable[String] { | ||
|
||
override def spliterator(): java.util.Spliterator[String] = { | ||
super[Iterable].spliterator | ||
super.spliterator | ||
null | ||
} | ||
def foo = { | ||
super[Iterable].spliterator | ||
super.spliterator | ||
} | ||
def iterator(): java.util.Iterator[String] = java.util.Collections.emptyList().iterator() | ||
} | ||
class C extends T | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
val t: T = new C | ||
t.spliterator | ||
t.foo | ||
} | ||
} |
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,21 @@ | ||
trait T extends java.lang.Iterable[String] { | ||
|
||
override def spliterator(): java.util.Spliterator[String] = { | ||
super[Iterable].spliterator | ||
super.spliterator | ||
null | ||
} | ||
def foo = { | ||
super[Iterable].spliterator | ||
super.spliterator | ||
} | ||
def iterator(): java.util.Iterator[String] = java.util.Collections.emptyList().iterator() | ||
} | ||
class C extends T with java.lang.Iterable[String] // super accessor is okay with Iterable as a direct parent | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
val t: T = new C | ||
t.spliterator | ||
t.foo | ||
} | ||
} |