NOTE: This is a sketch of the proposal, many details need to be filled out and the scheme hasn't been implemented yet.
G |- T <: S
--------------------
G |- T#L <: S#L
------------------------------
G |- {L: X..Y, ...}#L <: Y
% javap -c Meter | |
Compiled from "Meter.scala" | |
public class Meter { | |
public static boolean canEqual(java.lang.Object); | |
Code: | |
0: getstatic #15 // Field Meter$.MODULE$:LMeter$; | |
3: aload_0 | |
4: invokevirtual #17 // Method Meter$.canEqual:(Ljava/lang/Object;)Z | |
7: ireturn |
NOTE: This is a sketch of the proposal, many details need to be filled out and the scheme hasn't been implemented yet.
G |- T <: S
--------------------
G |- T#L <: S#L
------------------------------
G |- {L: X..Y, ...}#L <: Y
class A extends java.lang.this#Object with scala.this#Any { | |
^inherited^ final def $asInstanceOf[ java.lang.Object.T0 >: scala.this#Nothing <: scala.this#Any](): <java.lang.Object.T0> | |
^inherited^ final def $isInstanceOf[ java.lang.Object.T0 >: scala.this#Nothing <: scala.this#Any](): scala.this#Boolean | |
^inherited^ final def synchronized[ java.lang.Object.T0 >: scala.this#Nothing <: scala.this#Any](x$1: <java.lang.Object.T0>): <java.lang.Object.T0> | |
^inherited^ final def ##(): scala.this#Int | |
^inherited^ final def !=(x$1: scala.this#Any): scala.this#Boolean | |
^inherited^ final def ==(x$1: scala.this#Any): scala.this#Boolean | |
^inherited^ final def ne(x$1: java.lang.this#Object): scala.this#Boolean | |
^inherited^ final def eq(x$1: java.lang.this#Object): scala.this#Boolean | |
^inherited^ @scala.this#throws[java.lang.this#Throwable]( = (classOf[java.lang.Throwable])) protected[java.lang] def finalize(): scala.this#Unit |
exception occurred while typechecking try/i576b.scala | |
exception occurred while compiling try/i576b.scala | |
Exception in thread "main" java.lang.AssertionError: assertion failed: non-existent getter denotation (val <none>) for getter(foo$default$1) | |
at scala.Predef$.assert(Predef.scala:165) | |
at dotty.tools.dotc.typer.Applications$Application.findGetter$1(Applications.scala:280) | |
at dotty.tools.dotc.typer.Applications$Application.findDefaultGetter(Applications.scala:284) | |
at dotty.tools.dotc.typer.Applications$Application.tryDefault$1(Applications.scala:327) | |
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:358) | |
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:192) | |
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:434) |
java.lang.StackOverflowError | |
at java.lang.ClassLoader.defineClass1(Native Method) | |
at java.lang.ClassLoader.defineClass(ClassLoader.java:760) | |
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) | |
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) | |
at java.net.URLClassLoader.access$100(URLClassLoader.java:73) | |
at java.net.URLClassLoader$1.run(URLClassLoader.java:368) | |
at java.net.URLClassLoader$1.run(URLClassLoader.java:362) | |
at java.security.AccessController.doPrivileged(Native Method) | |
at java.net.URLClassLoader.findClass(URLClassLoader.java:361) |
[error] scala.MatchError: NoType$() (of class dotty.tools.dotc.core.Types$NoType$) | |
[error] at dotty.tools.dotc.core.SymDenotations$SymDenotation.sourceModule(SymDenotations.scala:782) | |
[error] at dotty.tools.dotc.core.SymDenotations$SymDenotation.scalacLinkedClass(SymDenotations.scala:914) | |
[error] at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:600) | |
[error] at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:546) | |
[error] at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.complete(TreeUnpickler.scala:91) | |
[error] at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:210) | |
[error] at dotty.tools.dotc.core.SymDenotations$SymDenotation.info(SymDenotations.scala:188) | |
[error] at dotty.tools.dotc.core.SymDenotations$ClassDenotation.membersNamed(SymDenotations.scala:1538) | |
[error] at dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:1591) |
cannot take signature of => B.this.Foo | |
exception while transforming () extends Object() with A {} of class class dotty.tools.dotc.ast.Trees$Template # 93 | |
exception while transforming class B() extends Object() with A {} of class class dotty.tools.dotc.ast.Trees$TypeDef # 94 | |
exception while transforming package <empty> { | |
<trait> trait A() extends Object { | |
private type Foo = Int | |
def foo: A.this.Foo = 1 | |
} | |
class B() extends Object() with A {} | |
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 95 |
new files detected. rebuilding | |
[0m[[0minfo[0m] [0mLoading global plugins from /home/smarter/.sbt/0.13/plugins[0m | |
[0m[[0minfo[0m] [0mLoading project definition from /home/smarter/opt/dotty/project[0m | |
[0m[[0minfo[0m] [0mSet current project to dotty (in build file:/home/smarter/opt/dotty/)[0m | |
[0m[[33mwarn[0m] [0mMultiple main classes detected. Run 'show discoveredMainClasses' to see the list[0m | |
[0m[[33mwarn[0m] [0mMultiple main classes detected. Run 'show discoveredMainClasses' to see the list[0m | |
[0m[[0minfo[0m] [0mPackaging /home/smarter/opt/dotty/target/scala-2.11/dotty_2.11-0.1-SNAPSHOT-tests.jar ...[0m | |
[0m[[0minfo[0m] [0mDone packaging.[0m | |
[0m[[32msuccess[0m] [0mTotal time: 1 s, completed 29 févr. 2016 19:55:18[0m | |
/home/smarter/opt/dotty |
exception while transforming () extends Object { | |
<accessor> def o(): Outer = new Outer() | |
<accessor> def inner(): Outer.this.Inner = { | |
final class $anon($outer: MustBeATrait) extends Outer.this.Inner( | |
this.MustBeATrait$~$anon$$$outer().o() | |
) { | |
private <accessor> def $outer(): MustBeATrait | |
final def MustBeATrait$~$anon$$$outer(): MustBeATrait = $outer() | |
} | |
new Outer.this.Inner{...}(this): Outer.this.Inner |
abstract class A[T] { | |
object X { | |
def foo(x: T): T = x | |
} | |
} | |
object B extends A[Int] { // Change to String, fail as expected | |
} |