Skip to content

Commit

Permalink
Move rest of the warn tests from neg to warn (batch 3) (scala#19244)
Browse files Browse the repository at this point in the history
The last batch of tests, move tests other than tests/init/neg and
tests/neg to warn.
PR 4/5 (merge consecutively, per [Nicolas'
suggestion](scala#18829 (review))

Split up version of scala#18829
  • Loading branch information
szymon-rd authored Jan 25, 2024
2 parents a20027f + bfe0c70 commit 453658b
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 18 deletions.
1 change: 1 addition & 0 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ class CompilationTests {
implicit val testGroup: TestGroup = TestGroup("checkInitGlobal")
val options = defaultOptions.and("-Ysafe-init-global", "-Xfatal-warnings")
compileFilesInDir("tests/init-global/neg", options, FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkExpectedErrors()
compileFilesInDir("tests/init-global/warn", defaultOptions.and("-Ysafe-init-global"), FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkWarnings()
compileFilesInDir("tests/init-global/pos", options, FileFilter.exclude(TestSources.posInitGlobalScala2LibraryTastyBlacklisted)).checkCompile()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ object Test:
class Box(val x: Int)

def recur(a: => Box, b: => Box): Int =
a.x + recur(a, b) + b.x // error // error
a.x + recur(a, b) + b.x // warn // warn

recur(Box(1), Box(2))
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ object Test:
class Box(val x: Int)

def recur(a: => Box, b: Box): Int =
a.x + recur(a, b) + b.x // error
a.x + recur(a, b) + b.x // warn

recur(Box(1), Box(2))
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ object Test:
class Box(val x: Int)

def recur(a: => Box, b: => Box): Int =
a.x + recur(a: @widen(5), b: @widen(5)) + b.x // error // error
a.x + recur(a: @widen(5), b: @widen(5)) + b.x // warn // warn

recur(Box(1), Box(2))
13 changes: 0 additions & 13 deletions tests/neg-deep-subtype/i4297.scala

This file was deleted.

4 changes: 4 additions & 0 deletions tests/neg-macros/i9570.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Error: tests/neg-macros/i9570.scala:15:21 ---------------------------------------------------------------------------
15 | case '{HCons(_,$t)} => // error
| ^
| Use of `_` for lambda in quoted pattern. Use explicit lambda instead or use `$_` to match any term.
2 changes: 1 addition & 1 deletion tests/neg-macros/i9570.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object Macros {
private def sizeImpl(e: Expr[HList], n:Int)(using qctx:Quotes): Expr[Int] = {
import quotes.reflect.*
e match {
case '{HCons(_,$t)} => // error if run with fatal warinings in BootstrappedOnlyCompilationTests
case '{HCons(_,$t)} => // error
sizeImpl(t,n+1)
case '{HNil} => Expr(n)
}
Expand Down
4 changes: 4 additions & 0 deletions tests/neg-macros/macro-deprecation.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Error: tests/neg-macros/macro-deprecation.scala:5:18 ----------------------------------------------------------------
5 |inline def f = ${ impl } // error
| ^^^^
| method impl is deprecated
2 changes: 1 addition & 1 deletion tests/neg-macros/macro-deprecation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
import scala.quoted.*

inline def f = ${ impl } // error
@deprecated def impl(using Quotes) = '{1}
@deprecated def impl(using Quotes) = '{1}

0 comments on commit 453658b

Please sign in to comment.