Skip to content

Add regression tests #14797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/neg/i10943.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- [E007] Type Mismatch Error: tests/neg/i10943.scala:5:10 -------------------------------------------------------------
5 | val a = new A : Int // error
| ^^^^^
| Found: T.A
| Required: Int
|
| longer explanation available when compiling with `-explain`
6 changes: 6 additions & 0 deletions tests/neg/i10943.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import language.experimental.fewerBraces

object T:
class A
val a = new A : Int // error
end T
24 changes: 24 additions & 0 deletions tests/pos/i12216.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import scala.language.implicitConversions

sealed abstract class CtorType[P]

object CtorType {
final class Props[P] extends CtorType[P] {
def whyHelloThere(props: P): Unit = ()
}
}

trait Comp[P, CT[p] <: CtorType[p]] {
val ctor: CT[P]
}
object Comp {
implicit def autoCtor[P, CT[p] <: CtorType[p]](c: Comp[P, CT]): CT[P] = c.ctor
}

object Test {
val comp: Comp[Int, CtorType.Props] = ???

comp.whyHelloThere(3)

Comp.autoCtor(comp).whyHelloThere(3)
}
12 changes: 12 additions & 0 deletions tests/pos/i12655.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
trait Signature:
type Impl[A, U]

type Operation[Z <: Signature, A, U] = (z: Z) => z.Impl[A, U]

case class Perform0[Z <: Signature, A, U](op: Operation[Z, A, U])

case class Perform1[Z <: Signature, A, U](op: (z: Z) => z.Impl[A, U])

def perform0[Z <: Signature, A, U](op: Operation[Z, A, U]): Unit = ???

def perform1[Z <: Signature, A, U](op: (z: Z) => z.Impl[A, U]): Unit = ???
14 changes: 14 additions & 0 deletions tests/pos/i3058.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
trait C[T] { type U }

object C { type Aux[X, Y] = C[X] { type U = Y } }


def a: C[Int] { type U = Int } = ???

def b[T](c: C[T]): C[T] { type U = c.U } = ???


def t[T, U](c: C.Aux[T, U]) = ???


object Test { t(b(a)) }