Skip to content

Commit fcdbec0

Browse files
committed
Add warn functionality to Vulpix & move tests/init from neg to warn
1 parent feed938 commit fcdbec0

File tree

153 files changed

+197
-192
lines changed

Some content is hidden

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

153 files changed

+197
-192
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ class CompilationTests {
216216
@Test def checkInitGlobal: Unit = {
217217
implicit val testGroup: TestGroup = TestGroup("checkInitGlobal")
218218
val options = defaultOptions.and("-Ysafe-init-global", "-Xfatal-warnings")
219+
compileFilesInDir("tests/init-global/neg", options).checkExpectedErrors()
220+
compileFilesInDir("tests/init-global/pos", options).checkCompile()
219221
compileFilesInDir("tests/init-global/neg", options, FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkExpectedErrors()
222+
compileFilesInDir("tests/init-global/warn", defaultOptions.and("-Ysafe-init-global"), FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkWarnings()
220223
compileFilesInDir("tests/init-global/pos", options, FileFilter.exclude(TestSources.posInitGlobalScala2LibraryTastyBlacklisted)).checkCompile()
221224
}
222225

@@ -225,6 +228,7 @@ class CompilationTests {
225228
implicit val testGroup: TestGroup = TestGroup("checkInit")
226229
val options = defaultOptions.and("-Ysafe-init", "-Xfatal-warnings")
227230
compileFilesInDir("tests/init/neg", options).checkExpectedErrors()
231+
compileFilesInDir("tests/init/warn", defaultOptions.and("-Ysafe-init")).checkWarnings()
228232
compileFilesInDir("tests/init/pos", options).checkCompile()
229233
compileFilesInDir("tests/init/crash", options.without("-Xfatal-warnings")).checkCompile()
230234
// The regression test for i12128 has some atypical classpath requirements.

tests/init/neg/early-promote2.scala

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/init/neg/simple1.scala

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/init/neg/soundness4.scala

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/init/neg/AbstractFile.scala renamed to tests/init/warn/AbstractFile.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ abstract class AbstractFile {
44
}
55

66
class RemoteFile(url: String) extends AbstractFile {
7-
val localFile: String = s"${url.##}.tmp" // error: usage of `localFile` before it's initialized
7+
val localFile: String = s"${url.##}.tmp" // warn: usage of `localFile` before it's initialized
88
def name: String = localFile
99
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Foo {
22
val self = this
33
val x = self.n
4-
val n = 10 // error
4+
val n = 10 // warn
55
}

tests/init/neg/apply.scala renamed to tests/init/warn/apply.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ object A:
66

77
class B:
88
val a = A(this)
9-
val a2 = A.foo(this) // error
9+
val a2 = A.foo(this) // warn
1010
val a3 = A.bar(this)
1111

1212
// test receiver is ThisRef
@@ -20,7 +20,7 @@ object O:
2020

2121
class B:
2222
val a = A(this)
23-
val a2 = A.foo(this) // error
23+
val a2 = A.foo(this) // warn
2424
val a3 = A.bar(this)
2525

2626
val b = new B
@@ -38,7 +38,7 @@ class M(n: N):
3838

3939
class B:
4040
val a = A(this)
41-
val a2 = A.foo(this) // error
41+
val a2 = A.foo(this) // warn
4242
val a3 = A.bar(this)
4343
end M
4444

tests/init/neg/apply2.scala renamed to tests/init/warn/apply2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class O:
33
println(n)
44

55
class B:
6-
val a = A(this) // error
6+
val a = A(this) // warn
77

88
val b = new B
99
val n = 10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
final class MyAsInstanceOfClass(o: MyAsInstanceOfClass) {
22
val other: MyAsInstanceOfClass = {
33
if (o.asInstanceOf[MyAsInstanceOfClass].oRef ne null) o
4-
else new MyAsInstanceOfClass(this) // error
4+
else new MyAsInstanceOfClass(this) // warn
55
}
66
val oRef = o
77
}

tests/init/neg/by-name-error.scala renamed to tests/init/warn/by-name-error.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ object Foo {
88
}
99

1010
class A {
11-
val foo = implicitly[Foo] // error
11+
val foo = implicitly[Foo] // warn
1212
assert(foo eq foo.next)
1313
}

0 commit comments

Comments
 (0)