Skip to content

Commit 578672e

Browse files
committed
fix bootstrapped compilation tests
1 parent f9e6b88 commit 578672e

File tree

77 files changed

+148
-176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+148
-176
lines changed

tests/neg/i4935.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
object Foo {
2-
val (A, B) = () // error // error
2+
val (A, B) = (): @unchecked // error // error
33
}

tests/neg/i7879.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
object Test {
2-
val head1 +: _ = List(1).view
2+
val head1 +: _ = List(1).view: @unchecked
33
val _: Int = head1 // error
4-
}
4+
}

tests/neg/i9310.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//AE-d101cfe6d25117a51897609e673f6c8e74d31e6e
2-
val foo @ this = 0
2+
val foo @ this = 0: @unchecked
33
class Foo {
44
foo { } // error
5-
}
5+
}

tests/neg/refutable-pattern-binding-messages.check

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
-- Error: tests/neg/refutable-pattern-binding-messages.scala:5:14 ------------------------------------------------------
2+
5 | val Positive(p) = 5 // error: refutable extractor
3+
| ^^^^^^^^^^^^^^^
4+
| pattern binding uses refutable extractor `Test.Positive`
5+
|
6+
| If this usage is intentional, this can be communicated by adding `: @unchecked` after the expression,
7+
| which may result in a MatchError at runtime.
8+
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
19
-- Error: tests/neg/refutable-pattern-binding-messages.scala:6:14 ------------------------------------------------------
210
6 | for Positive(i) <- List(1, 2, 3) do () // error: refutable extractor
311
| ^^^^^^^^^^^
@@ -6,6 +14,14 @@
614
| If this usage is intentional, this can be communicated by adding the `case` keyword before the full pattern,
715
| which will result in a filtering for expression (using `withFilter`).
816
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
17+
-- Error: tests/neg/refutable-pattern-binding-messages.scala:10:20 -----------------------------------------------------
18+
10 | val i :: is = List(1, 2, 3) // error: pattern type more specialized
19+
| ^^^^^^^^^^^^^
20+
| pattern's type ::[Int] is more specialized than the right hand side expression's type List[Int]
21+
|
22+
| If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
23+
| which may result in a MatchError at runtime.
24+
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
925
-- Error: tests/neg/refutable-pattern-binding-messages.scala:11:11 -----------------------------------------------------
1026
11 | for ((x: String) <- xs) do () // error: pattern type more specialized
1127
| ^^^^^^
@@ -22,22 +38,6 @@
2238
| If the narrowing is intentional, this can be communicated by adding the `case` keyword before the full pattern,
2339
| which will result in a filtering for expression (using `withFilter`).
2440
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
25-
-- Error: tests/neg/refutable-pattern-binding-messages.scala:5:14 ------------------------------------------------------
26-
5 | val Positive(p) = 5 // error: refutable extractor
27-
| ^^^^^^^^^^^^^^^
28-
| pattern binding uses refutable extractor `Test.Positive`
29-
|
30-
| If this usage is intentional, this can be communicated by adding `: @unchecked` after the expression,
31-
| which may result in a MatchError at runtime.
32-
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
33-
-- Error: tests/neg/refutable-pattern-binding-messages.scala:10:20 -----------------------------------------------------
34-
10 | val i :: is = List(1, 2, 3) // error: pattern type more specialized
35-
| ^^^^^^^^^^^^^
36-
| pattern's type ::[Int] is more specialized than the right hand side expression's type List[Int]
37-
|
38-
| If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
39-
| which may result in a MatchError at runtime.
40-
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
4141
-- Error: tests/neg/refutable-pattern-binding-messages.scala:16:10 -----------------------------------------------------
4242
16 | val 1 = 2 // error: pattern type does not match
4343
| ^

tests/neg/t5702-neg-bad-and-wild.check

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
|
2828
| longer explanation available when compiling with `-explain`
2929
-- [E032] Syntax Error: tests/neg/t5702-neg-bad-and-wild.scala:23:17 ---------------------------------------------------
30-
23 | val K(ns @ _*, xx) = k // error: pattern expected // error
30+
23 | val K(ns @ _*, xx) = k: @unchecked // error: pattern expected // error
3131
| ^
3232
| pattern expected
3333
|
3434
| longer explanation available when compiling with `-explain`
3535
-- [E161] Naming Error: tests/neg/t5702-neg-bad-and-wild.scala:24:10 ---------------------------------------------------
36-
24 | val K(x) = k // error: x is already defined as value x
37-
| ^^^^^^^^^^^^
36+
24 | val K(x) = k: @unchecked // error: x is already defined as value x
37+
| ^^^^^^^^^^^^^^^^^^^^^^^^
3838
| x is already defined as value x
3939
|
4040
| Note that overloaded methods must all be defined in the same group of toplevel definitions
@@ -51,24 +51,8 @@
5151
|
5252
| longer explanation available when compiling with `-explain`
5353
-- [E045] Cyclic Error: tests/neg/t5702-neg-bad-and-wild.scala:23:19 ---------------------------------------------------
54-
23 | val K(ns @ _*, xx) = k // error: pattern expected // error
54+
23 | val K(ns @ _*, xx) = k: @unchecked // error: pattern expected // error
5555
| ^
5656
| Recursive value $1$ needs type
5757
|
5858
| longer explanation available when compiling with `-explain`
59-
-- Warning: tests/neg/t5702-neg-bad-and-wild.scala:22:20 ---------------------------------------------------------------
60-
22 | val K(x @ _*) = k
61-
| ^
62-
| pattern's type Int* does not match the right hand side expression's type Int
63-
|
64-
| If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
65-
| which may result in a MatchError at runtime.
66-
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
67-
-- Warning: tests/neg/t5702-neg-bad-and-wild.scala:25:20 ---------------------------------------------------------------
68-
25 | val (b, _ * ) = (5,6) // ok
69-
| ^^^^^
70-
| pattern's type Int* does not match the right hand side expression's type Int
71-
|
72-
| If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
73-
| which may result in a MatchError at runtime.
74-
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.

tests/neg/t5702-neg-bad-and-wild.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ object Test {
1919

2020
// good syntax, bad semantics, detected by typer
2121
//gowild.scala:14: error: star patterns must correspond with varargs parameters
22-
val K(x @ _*) = k
23-
val K(ns @ _*, xx) = k // error: pattern expected // error
24-
val K(x) = k // error: x is already defined as value x
25-
val (b, _ * ) = (5,6) // ok
22+
val K(x @ _*) = k: @unchecked
23+
val K(ns @ _*, xx) = k: @unchecked // error: pattern expected // error
24+
val K(x) = k: @unchecked // error: x is already defined as value x
25+
val (b, _ * ) = (5,6): @unchecked // ok
2626
// no longer complains
2727
//bad-and-wild.scala:15: error: ')' expected but '}' found.
2828
}
2929
}
30-

tests/neg/trailingCommas.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ trait FunTypeParamClause { def f[A, B, ] } // error // error
2323
trait SimpleType { def f: (Int, String, ) } // error
2424
trait FunctionArgTypes { def f: (Int, String, ) => Boolean } // error
2525

26-
trait SimplePattern { val (foo, bar, ) = null: Any } // error
26+
trait SimplePattern { val (foo, bar, ) = null: Any @unchecked } // error
2727

2828
trait ImportSelectors { import foo.{ Ev0, Ev1, } } // error
2929

@@ -79,4 +79,4 @@ val a,
7979
b,
8080
c,
8181
= (1, 2, 3) // error
82-
val x, y, z, = (1, 2, 3) // error
82+
val x, y, z, = (1, 2, 3) // error

tests/pos-deep-subtype/i7580.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
def foo =
3-
val List(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, _:_*) = List.fill(25)(0)
3+
val List(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, _:_*) = List.fill(25)(0): @unchecked
44

55
()

tests/pos-macros/i12188b/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ object MatchTest {
66
def testImpl[T](objExpr: Expr[T])(using Quotes): Expr[Unit] = {
77
import quotes.reflect.*
88
// test that the extractors work
9-
val Inlined(None, Nil, Block(Nil, Match(param @ Ident("a"), List(CaseDef(Literal(IntConstant(1)), None, Block(Nil, Literal(UnitConstant()))), CaseDef(Wildcard(), None, Block(Nil, Literal(UnitConstant()))))))) = objExpr.asTerm
9+
val Inlined(None, Nil, Block(Nil, Match(param @ Ident("a"), List(CaseDef(Literal(IntConstant(1)), None, Block(Nil, Literal(UnitConstant()))), CaseDef(Wildcard(), None, Block(Nil, Literal(UnitConstant()))))))) = objExpr.asTerm: @unchecked
1010
// test that the constructors work
1111
Block(Nil, Match(param, List(CaseDef(Literal(IntConstant(1)), None, Block(Nil, Literal(UnitConstant()))), CaseDef(Wildcard(), None, Block(Nil, Literal(UnitConstant())))))).asExprOf[Unit]
1212
}

tests/pos-macros/i6435.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ class Foo {
33

44
def f(sc: quoted.Expr[StringContext])(using Quotes): Unit = {
55

6-
val '{ StringContext(${parts}*) } = sc
6+
val '{ StringContext(${parts}*) } = sc: @unchecked
77
val ps0: Expr[Seq[String]] = parts
88

9-
val '{ StringContext(${Varargs(parts2)}*) } = sc
9+
val '{ StringContext(${Varargs(parts2)}*) } = sc: @unchecked
1010
val ps: Seq[Expr[String]] = parts2
1111
}
12-
}
12+
}

tests/pos-macros/i6998.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import scala.quoted.*
22

33
def foo(using Quotes) : Unit = {
4-
val '{ $f : (Int => Double) } = ??? : Expr[Any]
4+
val '{ $f : (Int => Double) } = ??? : Expr[Any] @unchecked
55
}

tests/pos-macros/i7204.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import scala.quoted.*
33
object Foo {
44
def impl(using Quotes) : Unit = {
55
import quotes.reflect.*
6-
val Select(_, _) = (??? : Term)
6+
val Select(_, _) = (??? : Term): @unchecked
77
}
88
}

tests/pos-macros/i8577a/Main_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ def main: Unit =
55
extension (inline ctx: Macro.StrCtx) inline def unapplySeq(inline input: Int): Option[Seq[Int]] =
66
${ implUnapply('ctx, 'input) }
77

8-
val mac"$x" = 1
8+
val mac"$x" = 1: @unchecked
99
assert(x == 1)

tests/pos-macros/i8577b/Main_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ def main: Unit =
55
extension (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: U): Option[Seq[U]] =
66
${ implUnapply('ctx, 'input) }
77

8-
val mac"$x" = 1
8+
val mac"$x" = 1: @unchecked
99
assert(x == 1)

tests/pos-macros/i8577c/Main_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ def main: Unit =
55
extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq(inline input: T): Option[Seq[T]] =
66
${ implUnapply('ctx, 'input) }
77

8-
val mac"$x" = 1
8+
val mac"$x" = 1: @unchecked
99
assert(x == 1)

tests/pos-macros/i8577d/Main_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ def main: Unit =
55
extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: T): Option[Seq[T]] =
66
${ implUnapply('ctx, 'input) }
77

8-
val mac"$x" = 1
8+
val mac"$x" = 1: @unchecked
99
assert(x == 1)

tests/pos-macros/i8577e/Main_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ def main: Unit =
55
extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: U): Option[Seq[U]] =
66
${ implUnapply('ctx, 'input) }
77

8-
val mac"$x" = 1
8+
val mac"$x" = 1: @unchecked
99
assert(x == 1)

tests/pos-macros/i8577f/Main_2.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ def main: Unit =
55
extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: (T, U)): Option[Seq[(T, U)]] =
66
${ implUnapply('ctx, 'input) }
77

8-
val mac"$x" = (1, 2)
8+
val mac"$x" = (1, 2): @unchecked
99
assert(x == (1, 2))
1010

11-
val mac"$y" = (1, "a")
11+
val mac"$y" = (1, "a"): @unchecked
1212
assert(y == (1, "a"))

tests/pos-macros/i8577g/Main_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ def main: Unit =
55
extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: T | U): Option[Seq[T | U]] =
66
${ implUnapply('ctx, 'input) }
77

8-
val mac"$x" = 1
8+
val mac"$x" = 1: @unchecked
99
assert(x == 1)

tests/pos-macros/i8577h/Main_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ def main: Unit =
55
extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: U | T): Option[Seq[T | U]] =
66
${ implUnapply('ctx, 'input) }
77

8-
val mac"$x" = 1
8+
val mac"$x" = 1: @unchecked
99
assert(x == 1)

tests/pos-macros/tasty-constant-type/Macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ object Macro {
99
def impl[A <: Int : Type, B <: Int : Type](using Quotes) : Expr[AddInt[A, B]] = {
1010
import quotes.reflect.*
1111

12-
val ConstantType(IntConstant(v1)) = TypeRepr.of[A]
13-
val ConstantType(IntConstant(v2)) = TypeRepr.of[B]
12+
val ConstantType(IntConstant(v1)) = TypeRepr.of[A]: @unchecked
13+
val ConstantType(IntConstant(v2)) = TypeRepr.of[B]: @unchecked
1414

1515
Literal(IntConstant(v1 + v2)).tpe.asType match
1616
case '[t] => '{ null: AddInt[A, B] { type Out = t } }

tests/pos/endmarkers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package p1.p2:
1919
this()
2020
if x > 0 then
2121
val a :: b =
22-
x :: Nil
22+
(x :: Nil): @unchecked
2323
end val
2424
var y =
2525
x
@@ -55,4 +55,4 @@ package p1.p2:
5555
def ff: String = x.f
5656
end extension
5757

58-
end p2
58+
end p2

tests/pos/extractor-types.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package p1 {
22
object Ex { def unapply(p: Any): Option[_ <: Int] = null }
3-
object Foo { val Ex(_) = null }
3+
object Foo { val Ex(_) = null: @unchecked }
44
}
55
// a.scala:2: error: error during expansion of this match (this is a scalac bug).
66
// The underlying error was: type mismatch;
77
// found : Some[_$1(in value x$1)] where type _$1(in value x$1)
88
// required: Some[_$1(in method unapply)]
9-
// object Foo { val Ex(_) = null }
9+
// object Foo { val Ex(_) = null: @unchecked }
1010
// ^
1111
// one error found
1212

tests/pos/i15188.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ extension [T] (ctx: O.type) inline def unapplySeq(input: T): Option[Seq[T]] = So
44

55
@main
66
def Main = {
7-
val O(x) = 3
7+
val O(x) = 3: @unchecked
88
println(s"x: $x")
99
}

tests/pos/i15188b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ extension (ctx: C) inline def unapply(input: String): Option[String] = Some("hi"
44

55
@main def run = {
66
val O = new C
7-
val O(x) = "3"
7+
val O(x) = "3": @unchecked
88
}

tests/pos/i1540.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ object Casey1 { def unapply(a: Casey1) = a }
88

99
object Test {
1010
def main(args: Array[String]): Unit = {
11-
val c @ Casey1(x) = new Casey1(0)
11+
val c @ Casey1(x) = new Casey1(0): @unchecked
1212
assert(x == c.get)
1313
}
1414
}

tests/pos/i1540b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ object Casey1 { def unapply[T](a: Casey1[T]) = a }
88

99
object Test {
1010
def main(args: Array[String]): Unit = {
11-
val c @ Casey1(x) = new Casey1(0)
11+
val c @ Casey1(x) = new Casey1(0): @unchecked
1212
assert(x == c.get)
1313
}
1414
}

tests/pos/i15650.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object meta:
1212
def unapply(using Quotes)(using TC)(tr: quotes.reflect.TypeRepr): Option[Rational] = ???
1313

1414
def foo(using Quotes)(p: quotes.reflect.TypeRepr): Unit =
15-
val rationalTE(e) = p // warn: pattern binding uses refutable extractor `meta.rationalTE`
15+
val rationalTE(e) = p: @unchecked
1616

1717
def bar(using Quotes)(using TC)(p: quotes.reflect.TypeRepr): Unit =
18-
val rationalTC(c) = p // warn: pattern binding uses refutable extractor `meta.rationalTC`
18+
val rationalTC(c) = p: @unchecked

tests/pos/i7532.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ class Tasty {
1313
object Foo {
1414
def impl(using tasty: Tasty) : Unit = {
1515
import tasty.{_, given}
16-
val Select() = (??? : Term)
16+
val Select() = (??? : Term): @unchecked
1717
}
18-
}
18+
}

tests/pos/inline-i1773.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object Test {
77
}
88

99
def main(args: Array[String]): Unit = {
10-
val q"class $name extends $parent" = new Object
10+
val q"class $name extends $parent" = new Object: @unchecked
1111
println(name)
1212
println(parent)
1313
}

tests/pos/irrefutable.scala

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
// The test which this should perform but does not
2-
// is that f1 is recognized as irrefutable and f2 is not
3-
// This can be recognized via the generated classes:
4-
//
5-
// A$$anonfun$f1$1.class
6-
// A$$anonfun$f2$1.class
7-
// A$$anonfun$f2$2.class
8-
//
9-
// The extra one in $f2$ is the filter.
10-
//
11-
// !!! Marking with exclamation points so maybe someday
12-
// this test will be finished.
1+
// This tests that f1 is recognized as an irrefutable pattern and f2 is not
132
class A {
143
case class Foo[T](x: T)
154

165
def f1(xs: List[Foo[Int]]) = {
176
for (Foo(x: Int) <- xs) yield x
187
}
198
def f2(xs: List[Foo[Any]]) = {
20-
for (Foo(x: Int) <- xs) yield x
9+
for (case Foo(x: Int) <- xs) yield x
2110
}
2211
}

tests/pos/patdef.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ object Test {
44

55
val c: Any = C(1)
66

7-
val C(x) = c
7+
val C(x) = c: @unchecked
88

99
}

0 commit comments

Comments
 (0)