Skip to content

Commit 643ff4d

Browse files
committed
i16601 Fix class name in error message
1 parent d49c2d9 commit 643ff4d

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

compiler/src/dotty/tools/dotc/transform/PostTyper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
325325
// Check the constructor type as well; it could be an illegal singleton type
326326
// which would not be reflected as `tree.tpe`
327327
ctx.typer.checkClassType(nu.tpe, tree.srcPos, traitReq = false, stablePrefixReq = false)
328-
Checking.checkInstantiable(tree.tpe, nu.srcPos)
328+
Checking.checkInstantiable(nu.tpe, nu.srcPos)
329329
withNoCheckNews(nu :: Nil)(app1)
330330
case _ =>
331331
app1

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class CompilationTests {
159159
compileFile("tests/neg-custom-args/i9517.scala", defaultOptions.and("-Xprint-types")),
160160
compileFile("tests/neg-custom-args/i11637.scala", defaultOptions.and("-explain")),
161161
compileFile("tests/neg-custom-args/i15575.scala", defaultOptions.and("-explain")),
162+
compileFile("tests/neg-custom-args/i16601a.scala", defaultOptions.and("-explain")),
162163
compileFile("tests/neg-custom-args/interop-polytypes.scala", allowDeepSubtypes.and("-Yexplicit-nulls")),
163164
compileFile("tests/neg-custom-args/conditionalWarnings.scala", allowDeepSubtypes.and("-deprecation").and("-Xfatal-warnings")),
164165
compileFilesInDir("tests/neg-custom-args/isInstanceOf", allowDeepSubtypes and "-Xfatal-warnings"),

tests/neg/i16601.check

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- [E042] Type Error: tests/neg/i16601.scala:1:27 ----------------------------------------------------------------------
2+
1 |@main def Test: Unit = new concurrent.ExecutionContext // error
3+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
| ExecutionContext is a trait; it cannot be instantiated
5+
|
6+
| longer explanation available when compiling with `-explain`

tests/neg/i16601.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@main def Test: Unit = new concurrent.ExecutionContext // error

0 commit comments

Comments
 (0)