Skip to content

Instantly share code, notes, and snippets.

View smarter's full-sized avatar

Guillaume Martres smarter

View GitHub Profile
// usedNames: $anon,<init>,A,Any,B$,HasT,Int,Nothing,Object,T,X$,p,x
// topLevelDependencies: class A,class Any,class HasT,class Int,class Nothing,class Object,module class <empty>,module class B$
// topLevelInheritanceDependencies: class A,class HasT,class Object
trait HasT extends java.lang.this#Object with scala.this#Any {
^inherited^ def wait(x$0: scala.this#Long, x$1: scala.this#Int): scala.this#Unit
^inherited^ def wait(x$0: scala.this#Long): scala.this#Unit
^inherited^ def wait(): scala.this#Unit
^inherited^ protected def finalize(): scala.this#Unit
trait HasT { type T }
abstract class A {
val p: HasT
object X {
def foo(x: p.T): p.T = x
}
}
object B extends A {
// compile, change Int to String, compile succeeds but shouldn't
class Foo[T]
class A extends Foo[Int] // compile, change Int to String, compile succeeds but shouldn't
object B {
val x: A = new A
}
class A0
class A1 extends A0 // Compile, remove "extends A0", compile succeeds but shouldn't
object B {
val x: A1 = new A1
}
object A {
type T <: Int // Compile, change Int to String, compile succeeds but shouldn't
val x: T = null.asInstanceOf[T]
}
public class A {
interface B {};
public static <T extends A & B> T foo() {
return null;
}
public static void main(String[] args) {
B b = foo();
}
}
object Test {
def foo[M[_]](x: M[Int]) = x
type Alias[A] = (A, A)
val x: Alias[Int] = (1, 2)
foo(x) // Infer M=Alias
}
##### Transcripts from failed tests #####
# partest /home/smarter/opt/dotty/tests/partest-generated/pos/t1751
% javac t1751/SuiteClasses.java
% javac -d /home/smarter/opt/dotty/tests/partest-generated/pos/t1751-pos.obj -classpath /home/smarter/opt/dotty/tests/partest-generated/pos/t1751-pos.obj /home/smarter/opt/dotty/tests/partest-generated/pos/t1751/SuiteClasses.java
% scalac t1751/A2_1.scala
compiling /home/smarter/opt/dotty/tests/partest-generated/pos/t1751/A2_1.scala
options: #runs 2 -pagewidth 160 -Yno-deep-subtypes -Yno-double-bindings -Yforce-sbt-phases -d ./tests/partest-generated/pos/t1751-pos.obj -Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef -classpath ./tests/partest-generated/pos/t1751-pos.obj
/home/smarter/opt/dotty/tests/partest-generated/pos/t1751/A2_1.scala:7: error: none of the overloaded alternatives of constructor SuiteClasses in class SuiteClasses with types
-------
123
123
1
1
Cons(1,Cons(2,Cons(3,Nil)))
Cons(2,Nil)
Cons(1,Cons(3,Nil))
Cons(3,Nil)
Cons(true,Cons(true,Cons(true,Nil)))
[Unit]
Description=Emacs
[Service]
Type=forking
User=smarter
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
#Restart=on-failure