From f3f1e5060efe45eb01040f8332506c8c1dd26cfc Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 29 Sep 2012 16:24:43 -0700 Subject: [PATCH] SI-5353, imperfect error message. [backport] The fix of course is a perfect error message. --- src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala | 4 ++-- test/files/neg/t5353.check | 4 ++++ test/files/neg/t5353.scala | 3 +++ test/files/neg/t5692a.check | 2 +- test/files/neg/t5692b.check | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 test/files/neg/t5353.check create mode 100644 test/files/neg/t5353.scala diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala index 25b781364692..e8b0cd2696af 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala @@ -71,8 +71,8 @@ abstract class Pickler extends SubComponent { if (!t.isDef && t.hasSymbol && t.symbol.isTermMacro) { unit.error(t.pos, t.symbol.typeParams.length match { case 0 => "macro has not been expanded" - case 1 => "type parameter not specified" - case _ => "type parameters not specified" + case 1 => "this type parameter must be specified" + case _ => "these type parameters must be specified" }) return } diff --git a/test/files/neg/t5353.check b/test/files/neg/t5353.check new file mode 100644 index 000000000000..75e24356000a --- /dev/null +++ b/test/files/neg/t5353.check @@ -0,0 +1,4 @@ +t5353.scala:2: error: this type parameter must be specified + def f(x: Boolean) = if (x) Array("abc") else Array() + ^ +one error found diff --git a/test/files/neg/t5353.scala b/test/files/neg/t5353.scala new file mode 100644 index 000000000000..1ee869aac195 --- /dev/null +++ b/test/files/neg/t5353.scala @@ -0,0 +1,3 @@ +class A { + def f(x: Boolean) = if (x) Array("abc") else Array() +} diff --git a/test/files/neg/t5692a.check b/test/files/neg/t5692a.check index ded95a882011..7fbfb5dba7ee 100644 --- a/test/files/neg/t5692a.check +++ b/test/files/neg/t5692a.check @@ -1,4 +1,4 @@ -Test_2.scala:2: error: type parameter not specified +Test_2.scala:2: error: this type parameter must be specified def x = Macros.foo ^ one error found diff --git a/test/files/neg/t5692b.check b/test/files/neg/t5692b.check index e453870ec83e..16796826b471 100644 --- a/test/files/neg/t5692b.check +++ b/test/files/neg/t5692b.check @@ -1,4 +1,4 @@ -Test_2.scala:2: error: type parameters not specified +Test_2.scala:2: error: these type parameters must be specified def x = Macros.foo ^ one error found