diff options
Diffstat (limited to 'test')
20 files changed, 322 insertions, 3 deletions
diff --git a/test/files/presentation/context-bounds1.check b/test/files/presentation/context-bounds1.check new file mode 100644 index 0000000000..b444de59a4 --- /dev/null +++ b/test/files/presentation/context-bounds1.check @@ -0,0 +1,51 @@ +reload: ContextBounds.scala + +askHyperlinkPos for `Blubb` at (2,23) ContextBounds.scala +================================================================================ +[response] found askHyperlinkPos for `Blubb` at (13,7) ContextBounds.scala +================================================================================ + +askHyperlinkPos for `Foo` at (4,17) ContextBounds.scala +================================================================================ +[response] found askHyperlinkPos for `Foo` at (9,7) ContextBounds.scala +================================================================================ + +askHyperlinkPos for `Blubb` at (4,32) ContextBounds.scala +================================================================================ +[response] found askHyperlinkPos for `Blubb` at (13,7) ContextBounds.scala +================================================================================ + +askHyperlinkPos for `A` at (4,42) ContextBounds.scala +================================================================================ +[response] found askHyperlinkPos for `A` at (4,12) ContextBounds.scala +================================================================================ + +askHyperlinkPos for `A` at (4,51) ContextBounds.scala +================================================================================ +[response] found askHyperlinkPos for `A` at (4,12) ContextBounds.scala +================================================================================ + +askHyperlinkPos for `blubb` at (4,66) ContextBounds.scala +================================================================================ +[response] found askHyperlinkPos for `blubb` at (2,7) ContextBounds.scala +================================================================================ + +askHyperlinkPos for `Foo` at (5,18) ContextBounds.scala +================================================================================ +[response] found askHyperlinkPos for `Foo` at (9,7) ContextBounds.scala +================================================================================ + +askHyperlinkPos for `A` at (5,25) ContextBounds.scala +================================================================================ +[response] found askHyperlinkPos for `A` at (4,12) ContextBounds.scala +================================================================================ + +askHyperlinkPos for `foo` at (5,36) ContextBounds.scala +================================================================================ +[response] found askHyperlinkPos for `foo` at (10,7) ContextBounds.scala +================================================================================ + +askHyperlinkPos for `A` at (10,14) ContextBounds.scala +================================================================================ +[response] found askHyperlinkPos for `A` at (9,11) ContextBounds.scala +================================================================================ diff --git a/test/files/presentation/context-bounds1/Test.scala b/test/files/presentation/context-bounds1/Test.scala new file mode 100644 index 0000000000..bec1131c4c --- /dev/null +++ b/test/files/presentation/context-bounds1/Test.scala @@ -0,0 +1,3 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest
\ No newline at end of file diff --git a/test/files/presentation/context-bounds1/src/ContextBounds.scala b/test/files/presentation/context-bounds1/src/ContextBounds.scala new file mode 100644 index 0000000000..72a8f694a3 --- /dev/null +++ b/test/files/presentation/context-bounds1/src/ContextBounds.scala @@ -0,0 +1,13 @@ +object ContextBound { + val blubb = new Blubb/*#*/ + + def work[A: Foo/*#*/](f: Blubb/*#*/ => A/*#*/): A/*#*/ = f(blubb/*#*/) ensuring { + implicitly[Foo/*#*/[A/*#*/]].foo/*#*/(_) >= 42 + } +} + +trait Foo[A] { + def foo(a: A/*#*/): Int +} + +class Blubb
\ No newline at end of file diff --git a/test/files/presentation/t4287.check b/test/files/presentation/t4287.check new file mode 100644 index 0000000000..a922421e18 --- /dev/null +++ b/test/files/presentation/t4287.check @@ -0,0 +1,11 @@ +reload: Foo.scala + +askHyperlinkPos for `B` at (1,24) Foo.scala +================================================================================ +[response] found askHyperlinkPos for `B` at (3,8) Foo.scala +================================================================================ + +askHyperlinkPos for `a` at (1,31) Foo.scala +================================================================================ +[response] found askHyperlinkPos for `a` at (4,7) Foo.scala +================================================================================ diff --git a/test/files/presentation/t4287/Test.scala b/test/files/presentation/t4287/Test.scala new file mode 100644 index 0000000000..bec1131c4c --- /dev/null +++ b/test/files/presentation/t4287/Test.scala @@ -0,0 +1,3 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest
\ No newline at end of file diff --git a/test/files/presentation/t4287/src/Foo.scala b/test/files/presentation/t4287/src/Foo.scala new file mode 100644 index 0000000000..a744eaabe2 --- /dev/null +++ b/test/files/presentation/t4287/src/Foo.scala @@ -0,0 +1,5 @@ +class Baz(val f: Int = B/*#*/.a/*#*/) + +object B { + val a = 2 +} diff --git a/test/files/presentation/t4287b.check b/test/files/presentation/t4287b.check new file mode 100644 index 0000000000..d4b33650fd --- /dev/null +++ b/test/files/presentation/t4287b.check @@ -0,0 +1,6 @@ +reload: Foo.scala + +askHyperlinkPos for `i` at (14,11) Foo.scala +================================================================================ +[response] found askHyperlinkPos for `i` at (10,9) Foo.scala +================================================================================ diff --git a/test/files/presentation/t4287b/Test.scala b/test/files/presentation/t4287b/Test.scala new file mode 100644 index 0000000000..bec1131c4c --- /dev/null +++ b/test/files/presentation/t4287b/Test.scala @@ -0,0 +1,3 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest
\ No newline at end of file diff --git a/test/files/presentation/t4287b/src/Foo.scala b/test/files/presentation/t4287b/src/Foo.scala new file mode 100644 index 0000000000..47c676e2a2 --- /dev/null +++ b/test/files/presentation/t4287b/src/Foo.scala @@ -0,0 +1,15 @@ +trait Greeting { + val name: String + val msg = "How are you, "+name +} + +object Greeting { + val hello = "hello" +} + +class C(i: Int) extends { + val nameElse = "Bob" +} with Greeting { + val name = "avc" + println(i/*#*/) +}
\ No newline at end of file diff --git a/test/files/presentation/t4287c.check b/test/files/presentation/t4287c.check new file mode 100644 index 0000000000..42fc30997d --- /dev/null +++ b/test/files/presentation/t4287c.check @@ -0,0 +1,11 @@ +reload: Foo.scala + +askHyperlinkPos for `A` at (1,18) Foo.scala +================================================================================ +[response] found askHyperlinkPos for `A` at (3,8) Foo.scala +================================================================================ + +askHyperlinkPos for `a` at (1,25) Foo.scala +================================================================================ +[response] found askHyperlinkPos for `a` at (4,7) Foo.scala +================================================================================ diff --git a/test/files/presentation/t4287c.flags b/test/files/presentation/t4287c.flags new file mode 100644 index 0000000000..d1a8244169 --- /dev/null +++ b/test/files/presentation/t4287c.flags @@ -0,0 +1 @@ +-Yinfer-argument-types
\ No newline at end of file diff --git a/test/files/presentation/t4287c/Test.scala b/test/files/presentation/t4287c/Test.scala new file mode 100644 index 0000000000..bec1131c4c --- /dev/null +++ b/test/files/presentation/t4287c/Test.scala @@ -0,0 +1,3 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest
\ No newline at end of file diff --git a/test/files/presentation/t4287c/src/Foo.scala b/test/files/presentation/t4287c/src/Foo.scala new file mode 100644 index 0000000000..26870b5021 --- /dev/null +++ b/test/files/presentation/t4287c/src/Foo.scala @@ -0,0 +1,9 @@ +class A(a: Int = A/*#*/.a/*#*/) + +object A { + val a = 2 +} + +class B extends A { + def this(a) = this() +}
\ No newline at end of file diff --git a/test/files/run/t4287inferredMethodTypes.check b/test/files/run/t4287inferredMethodTypes.check new file mode 100644 index 0000000000..56e9c097cc --- /dev/null +++ b/test/files/run/t4287inferredMethodTypes.check @@ -0,0 +1,30 @@ +[[syntax trees at end of typer]] // newSource1.scala +[0:92]package [0:0]<empty> { + [0:21]class A extends [7:21][23]scala.AnyRef { + [8:16]<paramaccessor> private[this] val a: [8]Int = _; + <8:20>def <init>(<8:20>a: [11]<type: [11]scala.Int> = [17:20]A.a): [7]A = <8:20>{ + <8:20><8:20><8:20>A.super.<init>(); + <8:20>() + } + }; + [23:47]object A extends [32:47][49]scala.AnyRef { + [49]def <init>(): [32]A.type = [49]{ + [49][49][49]A.super.<init>(); + [32]() + }; + [36:45]private[this] val a: [40]Int = [44:45]2; + [40]<stable> <accessor> def a: [40]Int = [40][40]A.this.a; + [8]<synthetic> def <init>$default$1: [8]Int = [19]A.a + }; + [49:92]class B extends [57:92][65:66]A { + [65]def <init>(): [57]B = [65]{ + [65][65][65]B.super.<init>([65]A.<init>$default$1); + [57]() + }; + [70:90]def <init>([79:80]a: [79]Int): [74]B = [84:90]{ + [84:90][84:90][84]B.this.<init>(); + [84]() + } + } +} + diff --git a/test/files/run/t4287inferredMethodTypes.scala b/test/files/run/t4287inferredMethodTypes.scala new file mode 100644 index 0000000000..f14e672da8 --- /dev/null +++ b/test/files/run/t4287inferredMethodTypes.scala @@ -0,0 +1,25 @@ +import scala.tools.partest.DirectTest + +object Test extends DirectTest { + + override def extraSettings: String = + s"-usejavacp -Yinfer-argument-types -Xprint-pos -Xprint:typer -Yrangepos -Ystop-after:typer -d ${testOutput.path}" + + override def code = """ +class A(a: Int = A.a) + +object A { + val a = 2 +} + +class B extends A { + def this(a) = this() +} + """.trim + + override def show(): Unit = { + Console.withErr(System.out) { + compile() + } + } +}
\ No newline at end of file diff --git a/test/files/run/t5603.check b/test/files/run/t5603.check index 188f39ff82..760a92567c 100644 --- a/test/files/run/t5603.check +++ b/test/files/run/t5603.check @@ -10,10 +10,10 @@ [87:209]class C extends [94:209][151:159]Greeting { [119:139]val nameElse = _; [95:101]<paramaccessor> private[this] val i: [98:101]Int = _; - <119:139>def <init>([95]i: [98]Int) = <119:139>{ + <95:139>def <init>(<95:101>i: [98]Int) = <95:139>{ <119:139>val nameElse = <134:139>"Bob"; [NoPosition][NoPosition][NoPosition]super.<init>(); - [94]() + <95:139>() }; [168:184]val name = [179:184]"avc"; [191:203][191:198]println([199:202]msg) diff --git a/test/files/run/t7974.check b/test/files/run/t7974.check new file mode 100644 index 0000000000..0be496d8d0 --- /dev/null +++ b/test/files/run/t7974.check @@ -0,0 +1,104 @@ +public class Symbols { + + // compiled from: Symbols.scala + + + + // access flags 0x12 + private final Lscala/Symbol; someSymbol3 + + // access flags 0xA + private static Lscala/Symbol; symbol$1 + + // access flags 0xA + private static Lscala/Symbol; symbol$2 + + // access flags 0xA + private static Lscala/Symbol; symbol$3 + + // access flags 0x9 + public static <clinit>()V + L0 + LINENUMBER 2 L0 + GETSTATIC scala/Symbol$.MODULE$ : Lscala/Symbol$; + LDC "Symbolic1" + INVOKEVIRTUAL scala/Symbol$.apply (Ljava/lang/String;)Lscala/Symbol; + PUTSTATIC Symbols.symbol$1 : Lscala/Symbol; + L1 + LINENUMBER 3 L1 + GETSTATIC scala/Symbol$.MODULE$ : Lscala/Symbol$; + LDC "Symbolic2" + INVOKEVIRTUAL scala/Symbol$.apply (Ljava/lang/String;)Lscala/Symbol; + PUTSTATIC Symbols.symbol$2 : Lscala/Symbol; + L2 + LINENUMBER 5 L2 + GETSTATIC scala/Symbol$.MODULE$ : Lscala/Symbol$; + LDC "Symbolic3" + INVOKEVIRTUAL scala/Symbol$.apply (Ljava/lang/String;)Lscala/Symbol; + PUTSTATIC Symbols.symbol$3 : Lscala/Symbol; + RETURN + MAXSTACK = 2 + MAXLOCALS = 0 + + // access flags 0x1 + public someSymbol1()Lscala/Symbol; + L0 + LINENUMBER 2 L0 + GETSTATIC Symbols.symbol$1 : Lscala/Symbol; + ARETURN + L1 + LOCALVARIABLE this LSymbols; L0 L1 0 + MAXSTACK = 1 + MAXLOCALS = 1 + + // access flags 0x1 + public someSymbol2()Lscala/Symbol; + L0 + LINENUMBER 3 L0 + GETSTATIC Symbols.symbol$2 : Lscala/Symbol; + ARETURN + L1 + LOCALVARIABLE this LSymbols; L0 L1 0 + MAXSTACK = 1 + MAXLOCALS = 1 + + // access flags 0x1 + public sameSymbol1()Lscala/Symbol; + L0 + LINENUMBER 4 L0 + GETSTATIC Symbols.symbol$1 : Lscala/Symbol; + ARETURN + L1 + LOCALVARIABLE this LSymbols; L0 L1 0 + MAXSTACK = 1 + MAXLOCALS = 1 + + // access flags 0x1 + public someSymbol3()Lscala/Symbol; + L0 + LINENUMBER 5 L0 + ALOAD 0 + GETFIELD Symbols.someSymbol3 : Lscala/Symbol; + ARETURN + L1 + LOCALVARIABLE this LSymbols; L0 L1 0 + MAXSTACK = 1 + MAXLOCALS = 1 + + // access flags 0x1 + public <init>()V + L0 + LINENUMBER 6 L0 + ALOAD 0 + INVOKESPECIAL java/lang/Object.<init> ()V + L1 + LINENUMBER 5 L1 + ALOAD 0 + GETSTATIC Symbols.symbol$3 : Lscala/Symbol; + PUTFIELD Symbols.someSymbol3 : Lscala/Symbol; + RETURN + L2 + LOCALVARIABLE this LSymbols; L0 L2 0 + MAXSTACK = 2 + MAXLOCALS = 1 +} diff --git a/test/files/run/t7974/Symbols.scala b/test/files/run/t7974/Symbols.scala new file mode 100644 index 0000000000..2363b724eb --- /dev/null +++ b/test/files/run/t7974/Symbols.scala @@ -0,0 +1,6 @@ +class Symbols { + def someSymbol1 = 'Symbolic1 + def someSymbol2 = 'Symbolic2 + def sameSymbol1 = 'Symbolic1 + val someSymbol3 = 'Symbolic3 +} diff --git a/test/files/run/t7974/Test.scala b/test/files/run/t7974/Test.scala new file mode 100644 index 0000000000..9403ea332b --- /dev/null +++ b/test/files/run/t7974/Test.scala @@ -0,0 +1,20 @@ +import java.io.PrintWriter; + +import scala.tools.partest.BytecodeTest +import scala.tools.asm.util._ +import scala.tools.nsc.util.stringFromWriter + +object Test extends BytecodeTest { + def show { + val classNode = loadClassNode("Symbols", skipDebugInfo = false) + val textifier = new Textifier + classNode.accept(new TraceClassVisitor(null, textifier, null)) + + val classString = stringFromWriter(w => textifier.print(w)) + val result = + classString.split('\n') + .dropWhile(elem => elem != "public class Symbols {") + .filterNot(elem => elem.startsWith(" @Lscala/reflect/ScalaSignature") || elem.startsWith(" ATTRIBUTE ScalaSig")) + result foreach println + } +} diff --git a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala index c5cac3ea45..fe90d7222f 100644 --- a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala +++ b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala @@ -92,7 +92,7 @@ trait ArbitraryTreesAndNames { yield DefDef(mods, name, tparams, vparamss, tpt, rhs) def genExistentialTypeTree(size: Int) = - for(tpt <- genTree(size - 1); where <- smallList(size, genTree(size - 1))) + for(tpt <- genTree(size - 1); where <- smallList(size, oneOf(genValDef(size - 1), genTypeDef(size - 1)))) yield ExistentialTypeTree(tpt, where) def genFunction(size: Int) = |