Skip to content

Commit 314a588

Browse files
committed
add tests extracted from scalameta
1 parent 785e98a commit 314a588

24 files changed

+545
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package example
2+
3+
class Access {
4+
private def m1 = ???
5+
private[this] def m2 = ???
6+
private[Access] def m3 = ???
7+
protected def m4 = ???
8+
protected[this] def m5 = ???
9+
protected[example] def m6 = ???
10+
def m7 = ???
11+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package example
2+
3+
import scala.language.existentials
4+
import scala.language.higherKinds
5+
import scala.language.reflectiveCalls
6+
7+
class AdvC[T] {
8+
def t: T = ???
9+
}
10+
11+
class Structural {
12+
def s1: { val x: Int } = ???
13+
def s2 = new { val x: Int = ??? }
14+
def s3 = new { def m(x: Int): Int = ??? }
15+
}
16+
17+
class Existential {
18+
def e1: List[_] = ???
19+
}
20+
21+
class AdvD[CC[B]] extends AdvC[CC[B]]
22+
23+
object AdvTest {
24+
val s = new Structural
25+
val s1 = s.s1
26+
val s2 = s.s2
27+
val s3 = s.s3
28+
29+
val e = new Existential
30+
val e1 = e.e1
31+
val e1x = e.e1.head
32+
locally {
33+
(??? : Any) match {
34+
case e3: List[_] =>
35+
val e3x = e3.head
36+
()
37+
}
38+
}
39+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package example
2+
import scala.language.higherKinds
3+
4+
class Anonymous {
5+
this: Anonymous =>
6+
7+
def m1[T[_], B] = ???
8+
def m2: Map[_, List[_]] = ???
9+
locally {
10+
??? match { case _: List[_] => }
11+
}
12+
locally {
13+
val x: Int => Int = _ => ???
14+
}
15+
16+
trait Foo
17+
var x = new Foo {}
18+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package example
2+
3+
class C1(val x1: Int) extends AnyVal
4+
5+
class C2(val x2: Int) extends AnyVal
6+
object C2
7+
8+
case class C3(x: Int)
9+
10+
case class C4(x: Int)
11+
object C4
12+
13+
object M {
14+
implicit class C5(x: Int)
15+
}
16+
17+
case class C6(private val x: Int)
18+
19+
class C7(x: Int)
20+
21+
class C8(private[this] val x: Int)
22+
23+
class C9(private[this] var x: Int)
24+
25+
object N {
26+
val anonClass = new C7(42) {
27+
val local = ???
28+
}
29+
val anonFun = List(1).map { i =>
30+
val local = 2
31+
local + 2
32+
}
33+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package example
2+
3+
class AdvA {
4+
def b: AdvB = ???
5+
}
6+
7+
class AdvB {
8+
def a: AdvA = ???
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package example
2+
3+
object EmptyObject {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package example
2+
3+
import scala.concurrent.Future
4+
5+
object OExample { self =>
6+
new scala.collection.mutable.Stack[Int]()
7+
def main(args: Array[String]): Unit = {
8+
println(1)
9+
}
10+
val x = scala.reflect.classTag[Int]
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package example
2+
3+
// This class should be excluded by semanticdb.
4+
class Exclude
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package example
2+
3+
package object p {
4+
private lazy val x = 1
5+
protected implicit var y: Int = 2
6+
def z(pp: Int) = 3
7+
def m[TT] = ???
8+
abstract class C[+T, -U, V](x: T, y: U, z: V) {
9+
def this() = this(???, ???, ???)
10+
def w: Int
11+
}
12+
type T1 = Int
13+
type T2[T] = S[T]
14+
type U <: Int
15+
type V >: Int
16+
case object X
17+
final class Y
18+
sealed trait Z
19+
class AA(x: Int, val y: Int, var z: Int)
20+
class S[@specialized T]
21+
val List(xs1) = ???
22+
??? match { case List(xs2) => ??? }
23+
??? match { case _: List[t] => ??? }
24+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import scala.util.control.NonFatal

0 commit comments

Comments
 (0)