summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/matchStarlift.scala7
-rw-r--r--test/files/pos/t0422.scala16
-rw-r--r--test/files/pos/t0646.scala21
-rw-r--r--test/files/pos/t1014.scala15
-rw-r--r--test/files/pos/t1059.scala28
-rw-r--r--test/files/pos/t1203a.scala7
-rw-r--r--test/files/pos/t1626.scala4
-rw-r--r--test/files/pos/t1761.scala10
-rw-r--r--test/files/pos/t2281.scala41
-rw-r--r--test/files/pos/t2698.scala11
-rw-r--r--test/files/pos/t3160.scala6
-rw-r--r--test/files/pos/t4760.scala34
-rw-r--r--test/files/pos/t5858.scala3
-rw-r--r--test/files/pos/t6201.scala13
-rw-r--r--test/files/pos/t6897.scala6
-rw-r--r--test/files/pos/t7014/ThreadSafety.java9
-rw-r--r--test/files/pos/t7014/ThreadSafetyLevel.java8
-rw-r--r--test/files/pos/t7014/t7014.scala4
-rw-r--r--test/files/pos/t715/meredith_1.scala98
-rw-r--r--test/files/pos/t715/runner_2.scala3
-rw-r--r--test/files/pos/t7486-named.scala8
-rw-r--r--test/files/pos/t7486.scala8
-rw-r--r--test/files/pos/t7694.scala40
-rw-r--r--test/files/pos/t7716.scala16
-rw-r--r--test/files/pos/t7782.scala25
-rw-r--r--test/files/pos/t7782b.scala25
-rw-r--r--test/files/pos/t880.scala6
-rw-r--r--test/files/pos/t942/Amount_1.java5
-rw-r--r--test/files/pos/t942/Test_2.scala3
29 files changed, 185 insertions, 295 deletions
diff --git a/test/files/pos/matchStarlift.scala b/test/files/pos/matchStarlift.scala
deleted file mode 100644
index dab46eada2..0000000000
--- a/test/files/pos/matchStarlift.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-object Tet {
- import scala.xml._;
- def fooz(x: Node=>String) = {}
- def foo( m:Node ):Unit = fooz {
- case Elem(_,_,_,_,n,_*) if (n == m) => "gaga"
- }
-}
diff --git a/test/files/pos/t0422.scala b/test/files/pos/t0422.scala
deleted file mode 100644
index 2adfa392d2..0000000000
--- a/test/files/pos/t0422.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-package scala.xml.dtd.impl
-
-object BoolWordExp extends WordExp {
- type _labelT = MyLabels;
- type _regexpT = RegExp;
- abstract class MyLabels extends Label ;
- case class MyLabel(c:Char) extends MyLabels;
-}
-
-object MyTranslator extends WordBerrySethi {
- override val lang = BoolWordExp;
- import lang._;
- override protected def seenLabel( r:RegExp, i:Int, label: _labelT ): Unit = {
- super.seenLabel(r,i,label)
- }
-}
diff --git a/test/files/pos/t0646.scala b/test/files/pos/t0646.scala
deleted file mode 100644
index 6146e60020..0000000000
--- a/test/files/pos/t0646.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-object xfor {
-
- import scala.xml.NodeSeq
-
- val books =
- <bks>
- <title>Blabla</title>
- <title>Blubabla</title>
- <title>Baaaaaaalabla</title>
- </bks>;
-
- new NodeSeq { val theSeq = books.child } match {
- case t @ Seq(<title>Blabla</title>) => t
- }
-
- //val n: NodeSeq = new NodeSeq { val theSeq = books.child }
- //n match {
- // case t @ <title>Blabla</title> => t
- //}
-
-}
diff --git a/test/files/pos/t1014.scala b/test/files/pos/t1014.scala
deleted file mode 100644
index 3fc10d10dc..0000000000
--- a/test/files/pos/t1014.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-import scala.xml.{NodeSeq, Elem}
-
-class EO extends App with Moo {
- // return type is Flog, inherited from overridden method.
- // implicit conversions are applied because expected type `pt` is `Flog` when `computeType(rhs, pt)`.
- def cat = <cat>dog</cat>
-
- implicit def nodeSeqToFlog(in: Elem): Flog = new Flog(in)
-}
-
-trait Moo {
- def cat: Flog
-}
-
-class Flog(val in: NodeSeq)
diff --git a/test/files/pos/t1059.scala b/test/files/pos/t1059.scala
deleted file mode 100644
index bcd8f0374f..0000000000
--- a/test/files/pos/t1059.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-package com;
-
-import scala.xml._
-
-object Main {
-
- def main(args : Array[String]) : Unit = {
-
- var m : PartialFunction[Any, Any] = {
-
- case SafeNodeSeq(s @ _*) => println(s) }
-
- println(m(<a/> ++ <b/>))
- println(m.isDefinedAt(<a/> ++ <b/>))
-
- }
-
-}
-
-object SafeNodeSeq {
-
- def unapplySeq(any: Any) : Option[Seq[Node]] = any match { case s: Seq[_] => Some(s flatMap ( _ match {
-
- case n: Node => n case _ => NodeSeq.Empty
-
- })) case _ => None }
-
-}
diff --git a/test/files/pos/t1203a.scala b/test/files/pos/t1203a.scala
deleted file mode 100644
index 062ef93fc6..0000000000
--- a/test/files/pos/t1203a.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-case class ant(t: String) extends scala.annotation.Annotation
-object Test {
- def main(args: Array[String]): Unit = {
- val a: scala.xml.NodeSeq @ant("12") = Nil
- println(a)
- }
-}
diff --git a/test/files/pos/t1626.scala b/test/files/pos/t1626.scala
deleted file mode 100644
index 200be47430..0000000000
--- a/test/files/pos/t1626.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-object o {
- val n = <a xmlns=""/>
- n.namespace == null
-}
diff --git a/test/files/pos/t1761.scala b/test/files/pos/t1761.scala
deleted file mode 100644
index 2af7280734..0000000000
--- a/test/files/pos/t1761.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-import scala.xml._
-
-class Foo {
- val elements: Seq[Node] = Nil
- val innerTransform: PartialFunction[Elem, String] = {
- case Elem(_, l: String, _, _, _ @ _*) if elements.exists(_.label == l) =>
- l
- }
-}
-
diff --git a/test/files/pos/t2281.scala b/test/files/pos/t2281.scala
deleted file mode 100644
index 3515d2e2e6..0000000000
--- a/test/files/pos/t2281.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-import scala.collection.mutable.ArrayBuffer
-
-class A {
- def f(x: Boolean) = if (x) <br/><br/> else <br/>
-}
-
-class B {
- def splitSentences(text : String) : ArrayBuffer[String] = {
- val outarr = new ArrayBuffer[String]
- var outstr = new StringBuffer
- var prevspace = false
- val ctext = text.replaceAll("\n+","\n")
- ctext foreach {c =>
- outstr append c
- if(c == '.' || c == '!' || c == '?' || c == '\n' || c == ':' || c == ';' || (prevspace && c == '-') ){
- outarr += outstr.toString
- outstr = new StringBuffer
- }
- if(c == '\n'){
- outarr += "\n\n"
- }
- prevspace = c == ' '
- }
- if(outstr.length > 0){
- outarr += outstr.toString
- }
- outarr
- }
-
- def spanForSentence(x : String,picktext : String) =
- if(x == "\n\n"){
- <br/><br/>
- }else{
- <span class='clicksentence' style={if(x == picktext) "background-color: yellow" else ""}>{x}</span>
- }
-
- def selectableSentences(text : String, picktext : String) = {
- val sentences = splitSentences(text)
- sentences.map(x => spanForSentence(x,picktext))
- }
-} \ No newline at end of file
diff --git a/test/files/pos/t2698.scala b/test/files/pos/t2698.scala
deleted file mode 100644
index 7de50a13d6..0000000000
--- a/test/files/pos/t2698.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-package scala.xml.dtd.impl
-
-import scala.collection._
-
-abstract class S2 {
- val lang: WordExp
- type __labelT = lang._labelT
-
- var deltaq: Array[__labelT] = _
- def delta1 = immutable.Map(deltaq.zipWithIndex: _*)
-}
diff --git a/test/files/pos/t3160.scala b/test/files/pos/t3160.scala
deleted file mode 100644
index 3309ece160..0000000000
--- a/test/files/pos/t3160.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-import scala.collection.mutable._
-import scala.xml._
-
-class A {
- def f(x: Node): Node = ???
-}
diff --git a/test/files/pos/t4760.scala b/test/files/pos/t4760.scala
new file mode 100644
index 0000000000..767e3847f4
--- /dev/null
+++ b/test/files/pos/t4760.scala
@@ -0,0 +1,34 @@
+
+class Test {
+ // parses
+ def f1 = {
+ import scala._;
+ }
+ // b.scala:7: error: ';' expected but '}' found.
+ // }
+ // ^
+ // one error found
+ def f2 = {
+ import scala._
+ }
+ def f2b = {
+ import scala.collection.mutable.{ Map => MMap }
+ }
+ def f(): Unit = {
+ locally {
+ import scala.util.Properties.lineSeparator
+ }
+ }
+
+ // parses
+ def f3 = {
+ import scala._
+ 5
+ }
+ locally { (x: Int) =>
+ import scala.util._
+ }
+ 1 match {
+ case 1 => import scala.concurrent._
+ }
+}
diff --git a/test/files/pos/t5858.scala b/test/files/pos/t5858.scala
deleted file mode 100644
index f2b0f58d76..0000000000
--- a/test/files/pos/t5858.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object Test {
- new xml.Elem(null, null, xml.Null, xml.TopScope, Nil: _*) // was ambiguous
-}
diff --git a/test/files/pos/t6201.scala b/test/files/pos/t6201.scala
deleted file mode 100644
index 366c1f26eb..0000000000
--- a/test/files/pos/t6201.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-class Test {
- class Foo1 {
- def must(x: scala.xml.Elem) = ()
- }
-
- class Foo2 {
- def must(x: Int) = ()
- }
- implicit def toFoo1(s: scala.xml.Elem) = new Foo1()
- implicit def toFoo2(s: scala.xml.Elem) = new Foo2()
-
- def is: Unit = { (<a>{"a"}</a>).must(<a>{"b"}</a>) }
-} \ No newline at end of file
diff --git a/test/files/pos/t6897.scala b/test/files/pos/t6897.scala
deleted file mode 100644
index a7a03a1d3a..0000000000
--- a/test/files/pos/t6897.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-class A {
- val html = (null: Any) match {
- case 1 => <xml:group></xml:group>
- case 2 => <p></p>
- }
-}
diff --git a/test/files/pos/t7014/ThreadSafety.java b/test/files/pos/t7014/ThreadSafety.java
new file mode 100644
index 0000000000..ed508804e3
--- /dev/null
+++ b/test/files/pos/t7014/ThreadSafety.java
@@ -0,0 +1,9 @@
+package t7014;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME) // must be exactly RUNTIME retention (those we parse)
+public @interface ThreadSafety {
+ ThreadSafetyLevel level();
+} \ No newline at end of file
diff --git a/test/files/pos/t7014/ThreadSafetyLevel.java b/test/files/pos/t7014/ThreadSafetyLevel.java
new file mode 100644
index 0000000000..4df1dc787a
--- /dev/null
+++ b/test/files/pos/t7014/ThreadSafetyLevel.java
@@ -0,0 +1,8 @@
+package t7014; // package needed due to other bug in scalac's java parser
+
+// since we parse eagerly, we have not yet parsed the classfile when parsing the annotation,
+// and on doing so, fail to find a symbol for the COMPLETELY_THREADSAFE reference
+// from the annotation's argument to the enum's member
+// for now, let's just not crash -- should implement lazy completing at some point
+@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
+public enum ThreadSafetyLevel { COMPLETELY_THREADSAFE }
diff --git a/test/files/pos/t7014/t7014.scala b/test/files/pos/t7014/t7014.scala
new file mode 100644
index 0000000000..faec4c7740
--- /dev/null
+++ b/test/files/pos/t7014/t7014.scala
@@ -0,0 +1,4 @@
+package t7014
+
+import ThreadSafetyLevel.COMPLETELY_THREADSAFE // refer to annotation so it gets parsed
+ \ No newline at end of file
diff --git a/test/files/pos/t715/meredith_1.scala b/test/files/pos/t715/meredith_1.scala
deleted file mode 100644
index c28afb4a9b..0000000000
--- a/test/files/pos/t715/meredith_1.scala
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.sap.dspace.model.othello;
-
-import scala.xml._
-
-trait XMLRenderer {
- type T <: Any {def getClass(): java.lang.Class[_]}
- val valueTypes =
- List(
- classOf[java.lang.Boolean],
- classOf[java.lang.Integer],
- classOf[java.lang.Float],
- classOf[java.lang.String]
- // more to come
- )
-
- def value2XML(
- value: Object,
- field: java.lang.reflect.Field,
- pojo: T
- ): Node = {
- value match {
- case null => Text("null")
- case vUnmatched =>
- if (value.isInstanceOf[java.lang.Boolean])
- Text(value.asInstanceOf[java.lang.Boolean].toString)
- else if (value.isInstanceOf[java.lang.Integer])
- Text(value.asInstanceOf[java.lang.Integer].toString)
- else if (value.isInstanceOf[java.lang.Float])
- Text(value.asInstanceOf[java.lang.Float].toString)
- // else if (value.isInstanceOf[T])
- // pojo2XML(value.asInstanceOf[T])
- else
- <unmatchedType>
- <theType>
- {vUnmatched.getClass.toString}
- </theType>
- <theValue>
- {vUnmatched.toString}
- </theValue>
- </unmatchedType>
- }
- }
-
- def field2XML(
- field: java.lang.reflect.Field,
- pojo: T
- ): Elem = {
-
- val accessible = field.isAccessible
- field.setAccessible(true)
- // BUGBUG lgm need to disambiguate on type and possibly make
- // recursive call to pojo2XML
- val fldValXML = value2XML(field.get( pojo ), field, pojo)
- field.setAccessible( accessible )
-
- Elem(
- null,
- field.getName,
- null,
- TopScope,
- fldValXML
- )
- }
-
- def pojo2XML(pojo: T): Elem = {
- val progeny =
- for (field <- pojo.getClass.getDeclaredFields)
- yield field2XML(field, pojo)
-
- Elem(
- null,
- pojo.getClass.getName,
- null,
- TopScope,
- progeny.asInstanceOf[Array[scala.xml.Node]]: _*
- )
- }
-}
-
-case class POJO2XMLRenderer(recurse: Boolean)
- extends XMLRenderer {
- type T = java.io.Serializable
- override def value2XML(
- value: Object,
- field: java.lang.reflect.Field,
- pojo: java.io.Serializable
- ): Node = {
- if (recurse) super.value2XML(value, field, pojo)
- else Text(value + "")
- }
-}
-
-object thePOJO2XMLRenderer extends POJO2XMLRenderer(true) {
-}
-
-object Test extends App {
- println(com.sap.dspace.model.othello.thePOJO2XMLRenderer)
-}
diff --git a/test/files/pos/t715/runner_2.scala b/test/files/pos/t715/runner_2.scala
deleted file mode 100644
index d54805629a..0000000000
--- a/test/files/pos/t715/runner_2.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object Test extends App {
- println(com.sap.dspace.model.othello.thePOJO2XMLRenderer)
-}
diff --git a/test/files/pos/t7486-named.scala b/test/files/pos/t7486-named.scala
new file mode 100644
index 0000000000..253293e5f1
--- /dev/null
+++ b/test/files/pos/t7486-named.scala
@@ -0,0 +1,8 @@
+
+object Test {
+ def fold(empty: Any) = ()
+ implicit val notAnnotatedImplicit = new {
+ fold(empty = 0)
+ def empty[A]: Any = ???
+ }
+}
diff --git a/test/files/pos/t7486.scala b/test/files/pos/t7486.scala
new file mode 100644
index 0000000000..6dd7f4c4ac
--- /dev/null
+++ b/test/files/pos/t7486.scala
@@ -0,0 +1,8 @@
+object Test{
+ var locker = 0
+ // remove implicit, or change to `locker = locker + 1` to make it compile.
+ implicit val davyJones0 = {
+ locker += 0
+ 0
+ }
+}
diff --git a/test/files/pos/t7694.scala b/test/files/pos/t7694.scala
new file mode 100644
index 0000000000..9852d5ec79
--- /dev/null
+++ b/test/files/pos/t7694.scala
@@ -0,0 +1,40 @@
+trait A
+trait B
+
+trait L[A2, B2 <: A2] {
+ def bar(a: Any, b: Any) = 0
+}
+
+object Lub {
+ // use named args transforms to include TypeTree(<lub.tpe>) in the AST before refchecks.
+ def foo(a: L[_, _], b: Any) = 0
+
+ foo(b = 0, a = if (true) (null: L[A, A]) else (null: L[B, B]))
+
+ (if (true) (null: L[A, A]) else (null: L[B, B])).bar(b = 0, a = 0)
+}
+
+/*
+The LUB ends up as:
+
+TypeRef(
+ TypeSymbol(
+ abstract trait L#7038[A2#7039, B2#7040 <: A2#7039] extends AnyRef#2197
+
+ )
+ args = List(
+ AbstractTypeRef(
+ AbstractType(
+ type _1#13680 >: A#7036 with B#7037 <: Object#1752
+ )
+ )
+ AbstractTypeRef(
+ AbstractType(
+ type _2#13681 >: A#7036 with B#7037 <: Object#1752
+ )
+ )
+ )
+)
+
+Note that type _2#13681 is *not* bound by _1#13680
+*/
diff --git a/test/files/pos/t7716.scala b/test/files/pos/t7716.scala
new file mode 100644
index 0000000000..40117051ed
--- /dev/null
+++ b/test/files/pos/t7716.scala
@@ -0,0 +1,16 @@
+object Test {
+ def test: Unit = {
+ val e: java.lang.Enum[_] = java.util.concurrent.TimeUnit.SECONDS
+ e match { case x => println(x) }
+
+
+ trait TA[X <: CharSequence]
+ val ta: TA[_] = new TA[String] {}
+
+ ta match {
+ case _ => println("hi")
+ }
+
+ def f(ta: TA[_]) = ta match { case _ => "hi" }
+ }
+}
diff --git a/test/files/pos/t7782.scala b/test/files/pos/t7782.scala
new file mode 100644
index 0000000000..037bdad673
--- /dev/null
+++ b/test/files/pos/t7782.scala
@@ -0,0 +1,25 @@
+package pack
+
+object Test {
+ import O.empty
+ empty // this will trigger completion of `test`
+ // with skolemizationLevel = 1
+}
+
+object O {
+ // order matters (!!!)
+
+ // this order breaks under 2.10.x
+ def empty[E]: C[E] = ???
+ def empty(implicit a: Any): Any = ???
+}
+
+abstract class C[E] {
+ def foo[BB](f: BB)
+ def test[B](f: B): Any = foo(f)
+ // error: no type parameters for method foo: (<param> f: BB)scala.this.Unit exist so that it can be applied to arguments (B&1)
+ // --- because ---
+ // argument expression's type is not compatible with formal parameter type;
+ // found : B&1
+ // required: ?BB
+}
diff --git a/test/files/pos/t7782b.scala b/test/files/pos/t7782b.scala
new file mode 100644
index 0000000000..09da4a5c5b
--- /dev/null
+++ b/test/files/pos/t7782b.scala
@@ -0,0 +1,25 @@
+package pack
+
+object Test {
+ import O.empty
+ empty // this will trigger completion of `test`
+ // with skolemizationLevel = 1
+}
+
+object O {
+ // order matters (!!!)
+
+ // this order breaks under 2.11.x
+ def empty(implicit a: Any): Any = ???
+ def empty[E]: C[E] = ???
+}
+
+abstract class C[E] {
+ def foo[BB](f: BB)
+ def test[B](f: B): Any = foo(f)
+ // error: no type parameters for method foo: (<param> f: BB)scala.this.Unit exist so that it can be applied to arguments (B&1)
+ // --- because ---
+ // argument expression's type is not compatible with formal parameter type;
+ // found : B&1
+ // required: ?BB
+}
diff --git a/test/files/pos/t880.scala b/test/files/pos/t880.scala
deleted file mode 100644
index cceb53c398..0000000000
--- a/test/files/pos/t880.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-import scala.xml.Null
-
-class Test[A >: Null]
-{
- val x : A = null
-}
diff --git a/test/files/pos/t942/Amount_1.java b/test/files/pos/t942/Amount_1.java
new file mode 100644
index 0000000000..d9d37d127b
--- /dev/null
+++ b/test/files/pos/t942/Amount_1.java
@@ -0,0 +1,5 @@
+import java.util.concurrent.Callable;
+
+public abstract class Amount_1<Q> extends Object
+ implements Callable<Amount_1<?>> {
+}
diff --git a/test/files/pos/t942/Test_2.scala b/test/files/pos/t942/Test_2.scala
new file mode 100644
index 0000000000..3cc84dae3c
--- /dev/null
+++ b/test/files/pos/t942/Test_2.scala
@@ -0,0 +1,3 @@
+abstract class Foo {
+ val x: Amount_1[Foo]
+}