Skip to content

Commit ddecebc

Browse files
committed
Adapt tests
1 parent 6adab71 commit ddecebc

File tree

17 files changed

+32
-32
lines changed

17 files changed

+32
-32
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
scala> val res10 @ Some(_) = Option(1)
1+
scala> val res10 @ Some(_) = Option(1): @unchecked
22
val res10: Some[Int] = Some(1)
33
scala> res10
44
val res11: Some[Int] = Some(1)

compiler/test-resources/repl/i3536_patterndef_some

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
scala> val Some((res40, res41)) = Option((1, 0))
1+
scala> val Some((res40, res41)) = Option((1, 0)): @unchecked
22
val res40: Int = 1
33
val res41: Int = 0
44
scala> res40

compiler/test-resources/repl/i3966

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
scala> val List(x: _*) = List(1, 2)
1+
scala> val List(x: _*) = List(1, 2): @unchecked
22
val x: Seq[Int] = List(1, 2)

compiler/test-resources/repl/patdef

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
scala> val Const, x = 0
22
val Const: Int = 0
33
val x: Int = 0
4-
scala> val (Const, List(`x`, _, a), b) = (0, List(0, 1337, 1), 2)
4+
scala> val (Const, List(`x`, _, a), b) = (0, List(0, 1337, 1), 2): @unchecked
55
val a: Int = 1
66
val b: Int = 2
77
scala> val a@b = 0

compiler/test/dotty/tools/dotc/TastyBootstrapTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class TastyBootstrapTests {
5858
compileList("lib", librarySources,
5959
defaultOptions.and("-Ycheck-reentrant",
6060
"-language:experimental.erasedDefinitions", // support declaration of scala.compiletime.erasedValue
61-
// "-source", "future", // TODO: re-enable once we allow : @unchecked in pattern definitions. Right now, lots of narrowing pattern definitions fail.
61+
// "-source", "future", // TODO: re-enable once library uses updated syntax for vararg splices, wildcard imports, and import renaming
6262
))(libGroup)
6363

6464
val tastyCoreSources = sources(Paths.get("tasty/src"))

compiler/test/dotty/tools/dotc/ast/DesugarTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DesugarTests extends DottyTest {
2727
val ccTree = tree.find(tree => tree.symbol.name == typeName("Foo")).get
2828
val List(_, foo) = defPath(ccTree.symbol, tree).map(_.symbol.info)
2929

30-
val x :: y :: rest = foo.decls.toList
30+
val x :: y :: rest = foo.decls.toList: @unchecked
3131

3232
// Make sure we extracted the correct values from foo:
3333
assert(x.name == termName("x"))

compiler/test/dotty/tools/dotc/printing/PrinterTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class PrinterTests extends DottyTest {
4646

4747
checkCompile("typer", source) { (tree, context) =>
4848
given Context = context
49-
val bar @ Trees.DefDef(_, _, _, _) = tree.find(tree => tree.symbol.name == termName("bar2")).get
49+
val bar @ Trees.DefDef(_, _, _, _) = tree.find(tree => tree.symbol.name == termName("bar2")).get: @unchecked
5050
assertEquals("Int & (Boolean | String)", bar.tpt.show)
5151
}
5252
}

compiler/test/dotty/tools/dotc/reporting/UserDefinedErrorMessages.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class UserDefinedErrorMessages extends ErrorMessagesTest {
2626
given Context = itcx
2727

2828
assertMessageCount(1, messages)
29-
val (m: NoExplanation) :: Nil = messages
29+
val (m: NoExplanation) :: Nil = messages: @unchecked
3030

3131
assertEquals(m.msg, "Could not prove Int =!= Int")
3232
}
@@ -50,7 +50,7 @@ class UserDefinedErrorMessages extends ErrorMessagesTest {
5050
given Context = itcx
5151

5252
assertMessageCount(1, messages)
53-
val (m: NoExplanation) :: Nil = messages
53+
val (m: NoExplanation) :: Nil = messages: @unchecked
5454

5555
assertEquals(m.msg, "Could not prove Int =!= Int")
5656
}
@@ -75,7 +75,7 @@ class UserDefinedErrorMessages extends ErrorMessagesTest {
7575
given Context = itcx
7676

7777
assertMessageCount(1, messages)
78-
val (m: NoExplanation) :: Nil = messages
78+
val (m: NoExplanation) :: Nil = messages: @unchecked
7979

8080
assertEquals(m.msg, "Could not prove Int =!= Int")
8181
}
@@ -97,7 +97,7 @@ class UserDefinedErrorMessages extends ErrorMessagesTest {
9797
given Context = itcx
9898

9999
assertMessageCount(1, messages)
100-
val (m: NoExplanation) :: Nil = messages
100+
val (m: NoExplanation) :: Nil = messages: @unchecked
101101

102102
assertEquals(m.msg, "msg A=Any")
103103
}
@@ -119,7 +119,7 @@ class UserDefinedErrorMessages extends ErrorMessagesTest {
119119
given Context = itcx
120120

121121
assertMessageCount(1, messages)
122-
val (m: NoExplanation) :: Nil = messages
122+
val (m: NoExplanation) :: Nil = messages: @unchecked
123123

124124
assertEquals(m.msg, "msg A=Any")
125125
}

compiler/test/dotty/tools/repl/ReplCompilerTests.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,18 @@ class ReplCompilerTests extends ReplTest {
216216
}
217217

218218
@Test def `i10214 must show classic MatchError` = fromInitialState { implicit state =>
219-
run("val 1 = 2")
219+
run("val 1 = 2: @unchecked")
220220
assertEquals("scala.MatchError: 2 (of class java.lang.Integer)", storedOutput().linesIterator.next())
221221
}
222222
@Test def `i10214 must show useful regex MatchError` =
223223
fromInitialState { implicit state =>
224224
run("""val r = raw"\d+".r""")
225225
} andThen { implicit state =>
226-
run("""val r() = "abc"""")
226+
run("""val r() = "abc": @unchecked""")
227227
assertEquals("scala.MatchError: abc (of class java.lang.String)", storedOutput().linesIterator.drop(1).next())
228228
}
229229
@Test def `i10214 must show MatchError on literal type` = fromInitialState { implicit state =>
230-
run("val (x: 1) = 2")
230+
run("val (x: 1) = 2: @unchecked")
231231
assertEquals("scala.MatchError: 2 (of class java.lang.Integer)", storedOutput().linesIterator.next())
232232
}
233233
@Test def `i12920 must truncate stack trace to user code` = fromInitialState { implicit state =>

scaladoc/test/dotty/tools/scaladoc/tasty/comments/MemberLookupTests.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class LookupTestCases[Q <: Quotes](val q: Quotes) {
6060
val target = wrappedTarget.symbol
6161
val lookupRes = MemberLookup.lookupOpt(parseQuery(query), None)
6262
assertTrue(s"Couldn't look up: $query", lookupRes.nonEmpty)
63-
val Some((lookedUp, _, _)) = lookupRes
63+
val Some((lookedUp, _, _)) = lookupRes: @unchecked
6464
assertSame(query, target, lookedUp)
6565
}
6666

@@ -83,7 +83,7 @@ class LookupTestCases[Q <: Quotes](val q: Quotes) {
8383
val target = sym.symbol
8484
val lookupRes = MemberLookup.lookupOpt(parseQuery(query), None)
8585
assertTrue(s"Couldn't look up: $query", lookupRes.nonEmpty)
86-
val Some((_ , _, Some(owner))) = lookupRes
86+
val Some((_ , _, Some(owner))) = lookupRes: @unchecked
8787
assertSame(query, target, owner)
8888
}
8989
}
@@ -102,7 +102,7 @@ class LookupTestCases[Q <: Quotes](val q: Quotes) {
102102
val lookupRes = MemberLookup.lookupOpt(parseQuery(query), Some(cls("scala.=:=").symbol))
103103
assertTrue(s"Couldn't look up: $query", lookupRes.nonEmpty)
104104
println(lookupRes)
105-
val Some((_ , _, owner)) = lookupRes
105+
val Some((_ , _, owner)) = lookupRes: @unchecked
106106
assertSame(query, None, owner)
107107
}
108108
}
@@ -161,7 +161,7 @@ class LookupTestCases[Q <: Quotes](val q: Quotes) {
161161
)
162162

163163
cases.foreach { case ((Sym(owner), query), Sym(target)) =>
164-
val Some((lookedUp, _, _)) = MemberLookup.lookup(parseQuery(query), owner)
164+
val Some((lookedUp, _, _)) = MemberLookup.lookup(parseQuery(query), owner): @unchecked
165165
assertSame(s"$owner / $query", target, lookedUp)
166166
}
167167
}
@@ -176,7 +176,7 @@ class LookupTestCases[Q <: Quotes](val q: Quotes) {
176176
given q.type = q
177177

178178
def parseQuery(query: String): Query = {
179-
val Right(parsed) = QueryParser(query).tryReadQuery()
179+
val Right(parsed) = QueryParser(query).tryReadQuery(): @unchecked
180180
parsed
181181
}
182182

scaladoc/test/dotty/tools/scaladoc/tasty/comments/QueryParserTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ class QueryParserTests {
6464
private def parse(input: String) = QueryParser(input).tryReadQuery()
6565

6666
private def testSuccess(input: String, expected: Query) = {
67-
val Right(got) = parse(input)
67+
val Right(got) = parse(input): @unchecked
6868
assertEquals(expected, got)
6969
}
7070

7171
private def testFailAt(input: String, char: Int) = {
72-
val Left(err) = parse(input)
72+
val Left(err) = parse(input): @unchecked
7373
assertEquals(s"expected to fail at $char : $input", char, err.at)
7474
}
7575
}

tests/neg-macros/i6432/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object Macro {
99
import quotes.reflect.*
1010
sc match {
1111
case '{ StringContext(${Varargs(parts)}*) } =>
12-
for (part @ Expr(s) <- parts)
12+
for (case part @ Expr(s) <- parts)
1313
report.error(s, part.asTerm.pos)
1414
}
1515
'{}

tests/neg-macros/i6432b/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object Macro {
99
import quotes.reflect.*
1010
sc match {
1111
case '{ StringContext(${Varargs(parts)}*) } =>
12-
for (part @ Expr(s) <- parts)
12+
for (case part @ Expr(s) <- parts)
1313
report.error(s, part.asTerm.pos)
1414
}
1515
'{}

tests/patmat/for.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ object Test {
33
for ((a, b) <- l) yield a
44
}
55

6-
def bar(xs: List[(Int, List[Int])]): Unit = for ( (_, x :: y :: xs) <- xs) yield x
6+
def bar(xs: List[(Int, List[Int])]): Unit = for (case (_, x :: y :: xs) <- xs) yield x
77
}

tests/pos-special/fatal-warnings/i6621.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ object Unapply {
44
}
55

66
object Test {
7-
val Unapply(x, y) = ""
7+
val Unapply(x, y) = "": @unchecked
88
}

tests/semanticdb/expect/Synthetic.expect.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ class Synthetic/*<-example::Synthetic#*/ {
99

1010
// See https://github.com/scalameta/scalameta/issues/977
1111
val Name/*<-example::Synthetic#Name.*/ = "name:(.*)".r/*->scala::collection::StringOps#r().*/
12-
val x/*<-example::Synthetic#x.*/ #::/*->scala::package.`#::`.*/ xs/*<-example::Synthetic#xs.*/ = LazyList/*->scala::package.LazyList.*/(1, 2)
13-
val Name/*->example::Synthetic#Name.*/(name/*<-example::Synthetic#name.*/) = "name:foo"
12+
val x/*<-example::Synthetic#x.*/ #::/*->scala::package.`#::`.*/ xs/*<-example::Synthetic#xs.*/ = LazyList/*->scala::package.LazyList.*/(1, 2): @unchecked
13+
val Name/*->example::Synthetic#Name.*/(name/*<-example::Synthetic#name.*/) = "name:foo": @unchecked
1414
1 #:: 2 #:: LazyList/*->scala::package.LazyList.*/.empty/*->scala::collection::immutable::LazyList.empty().*/
1515

16-
val a1/*<-example::Synthetic#a1.*/ #::/*->scala::package.`#::`.*/ a2/*<-example::Synthetic#a2.*/ #::/*->scala::package.`#::`.*/ as/*<-example::Synthetic#as.*/ = LazyList/*->scala::package.LazyList.*/(1, 2)
16+
val a1/*<-example::Synthetic#a1.*/ #::/*->scala::package.`#::`.*/ a2/*<-example::Synthetic#a2.*/ #::/*->scala::package.`#::`.*/ as/*<-example::Synthetic#as.*/ = LazyList/*->scala::package.LazyList.*/(1, 2): @unchecked
1717

1818
val lst/*<-example::Synthetic#lst.*/ = 1 #:: 2 #:: LazyList/*->scala::package.LazyList.*/.empty/*->scala::collection::immutable::LazyList.empty().*/
1919

tests/semanticdb/expect/Synthetic.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ class Synthetic {
99

1010
// See https://github.com/scalameta/scalameta/issues/977
1111
val Name = "name:(.*)".r
12-
val x #:: xs = LazyList(1, 2)
13-
val Name(name) = "name:foo"
12+
val x #:: xs = LazyList(1, 2): @unchecked
13+
val Name(name) = "name:foo": @unchecked
1414
1 #:: 2 #:: LazyList.empty
1515

16-
val a1 #:: a2 #:: as = LazyList(1, 2)
16+
val a1 #:: a2 #:: as = LazyList(1, 2): @unchecked
1717

1818
val lst = 1 #:: 2 #:: LazyList.empty
1919

0 commit comments

Comments
 (0)