Skip to content

Commit 7b6a073

Browse files
authored
Merge pull request #14797 from pweisenburger/regression-tests-3058-10943-12216-12655
Add regression tests
2 parents 4848748 + 302c0ea commit 7b6a073

File tree

5 files changed

+63
-0
lines changed

5 files changed

+63
-0
lines changed

tests/neg/i10943.check

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- [E007] Type Mismatch Error: tests/neg/i10943.scala:5:10 -------------------------------------------------------------
2+
5 | val a = new A : Int // error
3+
| ^^^^^
4+
| Found: T.A
5+
| Required: Int
6+
|
7+
| longer explanation available when compiling with `-explain`

tests/neg/i10943.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import language.experimental.fewerBraces
2+
3+
object T:
4+
class A
5+
val a = new A : Int // error
6+
end T

tests/pos/i12216.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import scala.language.implicitConversions
2+
3+
sealed abstract class CtorType[P]
4+
5+
object CtorType {
6+
final class Props[P] extends CtorType[P] {
7+
def whyHelloThere(props: P): Unit = ()
8+
}
9+
}
10+
11+
trait Comp[P, CT[p] <: CtorType[p]] {
12+
val ctor: CT[P]
13+
}
14+
object Comp {
15+
implicit def autoCtor[P, CT[p] <: CtorType[p]](c: Comp[P, CT]): CT[P] = c.ctor
16+
}
17+
18+
object Test {
19+
val comp: Comp[Int, CtorType.Props] = ???
20+
21+
comp.whyHelloThere(3)
22+
23+
Comp.autoCtor(comp).whyHelloThere(3)
24+
}

tests/pos/i12655.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
trait Signature:
2+
type Impl[A, U]
3+
4+
type Operation[Z <: Signature, A, U] = (z: Z) => z.Impl[A, U]
5+
6+
case class Perform0[Z <: Signature, A, U](op: Operation[Z, A, U])
7+
8+
case class Perform1[Z <: Signature, A, U](op: (z: Z) => z.Impl[A, U])
9+
10+
def perform0[Z <: Signature, A, U](op: Operation[Z, A, U]): Unit = ???
11+
12+
def perform1[Z <: Signature, A, U](op: (z: Z) => z.Impl[A, U]): Unit = ???

tests/pos/i3058.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
trait C[T] { type U }
2+
3+
object C { type Aux[X, Y] = C[X] { type U = Y } }
4+
5+
6+
def a: C[Int] { type U = Int } = ???
7+
8+
def b[T](c: C[T]): C[T] { type U = c.U } = ???
9+
10+
11+
def t[T, U](c: C.Aux[T, U]) = ???
12+
13+
14+
object Test { t(b(a)) }

0 commit comments

Comments
 (0)