Skip to content

Commit

Permalink
Re-enable lost tests (#19903)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki authored Mar 11, 2024
2 parents 162b543 + 442170c commit 276d02b
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 8 deletions.
2 changes: 2 additions & 0 deletions tests/pos-custom-args/i4125.scala → tests/pos/i4125.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import scala.language.experimental.erasedDefinitions

object Test {
def foo: ((erased x: Int, y: Int) => Int) = (erased x, y) => 1
def bar: ((erased x: Int, y: Int) ?=> Int) = (erased x, y) ?=> 1
Expand Down
2 changes: 2 additions & 0 deletions tests/pos-custom-args/i4509.scala → tests/pos/i4509.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import scala.language.experimental.erasedDefinitions

object Main {
def fun[T](op: (erased Int) ?=> T) = op(using 0)
fun { }
Expand Down
7 changes: 5 additions & 2 deletions tests/pos-custom-args/i5938.scala → tests/pos/i5938.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import scala.language.experimental.erasedDefinitions

import compiletime.summonFrom
import compiletime.erasedValue

trait Link[T, A]

inline def link[T] =
transparent inline def link[T] =
summonFrom {
case _: Link[T, s] =>
summonFrom {
Expand All @@ -12,7 +15,7 @@ inline def link[T] =

class Foo
object Foo {
erased implicit val barLink: Link[Foo, Bar.type] = null
erased implicit val barLink: Link[Foo, Bar.type] = erasedValue
}

implicit object Bar {
Expand Down
2 changes: 2 additions & 0 deletions tests/pos-custom-args/i6009a.scala → tests/pos/i6009a.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import scala.language.experimental.erasedDefinitions

class Foo {
def foo(f: (erased Int) => Int): Int = {
erased val ctx = 1
Expand Down
2 changes: 2 additions & 0 deletions tests/pos-custom-args/i6009b.scala → tests/pos/i6009b.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import scala.language.experimental.erasedDefinitions

class Foo {
def foo(f: (erased Int) => Int): Int = {
erased val ctx = 1
Expand Down
2 changes: 2 additions & 0 deletions tests/pos-custom-args/i6009c.scala → tests/pos/i6009c.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import scala.language.experimental.erasedDefinitions

class Foo {
def foo(f: (erased Int) ?=> Int): Int = {
implicit erased val ctx = 1
Expand Down
2 changes: 2 additions & 0 deletions tests/pos-custom-args/i6419.scala → tests/pos/i6419.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import scala.language.experimental.erasedDefinitions

class Foo {
inline def foo: Unit = {
@scala.annotation.compileTimeOnly("some message") val res = ???
Expand Down
2 changes: 2 additions & 0 deletions tests/pos-custom-args/i7741.scala → tests/pos/i7741.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import scala.language.experimental.erasedDefinitions

class A1 {
@native private def a: Unit
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import scala.language.experimental.erasedDefinitions

object `inline-match-gadt` {
class Exactly[T]
erased def exactType[T]: Exactly[T] = compiletime.erasedValue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import compiletime.*
import scala.language.experimental.erasedDefinitions
import compiletime.erasedValue
import compiletime.ops.int.S
object Test {
type T[X] = X match {
case String => Int
case Int => String
}

type Len[X] <: Int = X match {
case Unit => 0
case EmptyTuple => 0
case x *: xs => S[Len[xs]]
}

Expand All @@ -28,7 +30,7 @@ object Test {
erased val z1: Head[(Int, String)] = 22

type Concat[X <: Tuple, Y <: Tuple] <: Tuple = X match {
case Unit => Y
case EmptyTuple => Y
case x1 *: xs1 => x1 *: Concat[xs1, Y]
}

Expand All @@ -55,8 +57,8 @@ object Test {
erased val y4: Elem[(String, Int, Boolean), 2] = erasedValue[Boolean]
erased val z4: Boolean = erasedValue[Elem[(String, Int, Boolean), 2]]

erased val y5: Concat[Unit, (String, Int)] = erasedValue[(String, Int)]
erased val z5: (String, Int) = erasedValue[Concat[Unit, (String, Int)]]
erased val y5: Concat[EmptyTuple, (String, Int)] = erasedValue[(String, Int)]
erased val z5: (String, Int) = erasedValue[Concat[EmptyTuple, (String, Int)]]
erased val y6: Concat[(Boolean, Boolean), (String, Int)] = erasedValue[Boolean *: Boolean *: (String, Int)]
erased val z6: Boolean *: Boolean *: (String, Int) = erasedValue[Concat[(Boolean, Boolean), (String, Int)]]
erased val y7: (Boolean, Boolean, String, Int) = erasedValue[Concat[(Boolean, Boolean), String *: Int *: EmptyTuple]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import scala.language.experimental.erasedDefinitions

object PhantomEq {
import EqUtil.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import scala.language.experimental.erasedDefinitions

/* This is a version of ../pos/phantomEq.scala that tests phantom with separate compilation */
object EqUtil {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import scala.language.experimental.erasedDefinitions

/** In this implementation variant of =:= (called =::=) we erase all instantiations and definitions of =::= */
object WithNormalState {
import Utils.*
Expand All @@ -24,5 +26,5 @@ object WithNormalState {

object Utils {
type =::=[From, To]
erased given tpEquals[A]: A =::= A = compiletime.erasedValue
erased given tpEquals[A]: (A =::= A) = compiletime.erasedValue
}

0 comments on commit 276d02b

Please sign in to comment.