summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala6
-rw-r--r--test/files/neg/t5353.check2
-rw-r--r--test/files/pos/t5692a.check (renamed from test/files/neg/t5692a.check)0
-rw-r--r--test/files/pos/t5692a.flags (renamed from test/files/neg/t5692a.flags)0
-rw-r--r--test/files/pos/t5692a/Macros_1.scala (renamed from test/files/neg/t5692a/Macros_1.scala)0
-rw-r--r--test/files/pos/t5692a/Test_2.scala (renamed from test/files/neg/t5692a/Test_2.scala)0
-rw-r--r--test/files/pos/t5692b.check (renamed from test/files/neg/t5692b.check)0
-rw-r--r--test/files/pos/t5692b.flags (renamed from test/files/neg/t5692b.flags)0
-rw-r--r--test/files/pos/t5692b/Macros_1.scala (renamed from test/files/neg/t5692b/Macros_1.scala)0
-rw-r--r--test/files/pos/t5692b/Test_2.scala (renamed from test/files/neg/t5692b/Test_2.scala)0
11 files changed, 6 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
index efe7519d5e..c8b7fcee8f 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -77,11 +77,7 @@ abstract class Pickler extends SubComponent {
}
if (!t.isDef && t.hasSymbolField && t.symbol.isTermMacro) {
- unit.error(t.pos, t.symbol.typeParams.length match {
- case 0 => "macro has not been expanded"
- case 1 => "this type parameter must be specified"
- case _ => "these type parameters must be specified"
- })
+ unit.error(t.pos, "macro has not been expanded")
return
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index a9e2d479db..b0b1341a07 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1061,6 +1061,7 @@ trait Typers extends Modes with Adaptations with Tags {
instantiateToMethodType(mt)
case _ =>
+ def vanillaAdapt(tree: Tree) = {
def shouldInsertApply(tree: Tree) = inAllModes(mode, EXPRmode | FUNmode) && (tree.tpe match {
case _: MethodType | _: OverloadedType | _: PolyType => false
case _ => applyPossible
@@ -1076,8 +1077,6 @@ trait Typers extends Modes with Adaptations with Tags {
}
if (tree.isType)
adaptType()
- else if (inExprModeButNot(mode, FUNmode) && treeInfo.isMacroApplication(tree))
- macroExpandApply(this, tree, mode, pt)
else if (inAllModes(mode, PATTERNmode | FUNmode))
adaptConstrPattern()
else if (shouldInsertApply(tree))
@@ -1206,6 +1205,9 @@ trait Typers extends Modes with Adaptations with Tags {
}
fallBack
}
+ }
+ val tree1 = if (inExprModeButNot(mode, FUNmode) && treeInfo.isMacroApplication(tree)) macroExpandApply(this, tree, mode, pt) else tree
+ if (tree == tree1) vanillaAdapt(tree1) else tree1
}
}
diff --git a/test/files/neg/t5353.check b/test/files/neg/t5353.check
index 75e2435600..bc3f77a4d6 100644
--- a/test/files/neg/t5353.check
+++ b/test/files/neg/t5353.check
@@ -1,4 +1,4 @@
-t5353.scala:2: error: this type parameter must be specified
+t5353.scala:2: error: macro has not been expanded
def f(x: Boolean) = if (x) Array("abc") else Array()
^
one error found
diff --git a/test/files/neg/t5692a.check b/test/files/pos/t5692a.check
index 7fbfb5dba7..7fbfb5dba7 100644
--- a/test/files/neg/t5692a.check
+++ b/test/files/pos/t5692a.check
diff --git a/test/files/neg/t5692a.flags b/test/files/pos/t5692a.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/neg/t5692a.flags
+++ b/test/files/pos/t5692a.flags
diff --git a/test/files/neg/t5692a/Macros_1.scala b/test/files/pos/t5692a/Macros_1.scala
index 06b5a3de36..06b5a3de36 100644
--- a/test/files/neg/t5692a/Macros_1.scala
+++ b/test/files/pos/t5692a/Macros_1.scala
diff --git a/test/files/neg/t5692a/Test_2.scala b/test/files/pos/t5692a/Test_2.scala
index 08d510cc6f..08d510cc6f 100644
--- a/test/files/neg/t5692a/Test_2.scala
+++ b/test/files/pos/t5692a/Test_2.scala
diff --git a/test/files/neg/t5692b.check b/test/files/pos/t5692b.check
index 16796826b4..16796826b4 100644
--- a/test/files/neg/t5692b.check
+++ b/test/files/pos/t5692b.check
diff --git a/test/files/neg/t5692b.flags b/test/files/pos/t5692b.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/neg/t5692b.flags
+++ b/test/files/pos/t5692b.flags
diff --git a/test/files/neg/t5692b/Macros_1.scala b/test/files/pos/t5692b/Macros_1.scala
index b28d19f903..b28d19f903 100644
--- a/test/files/neg/t5692b/Macros_1.scala
+++ b/test/files/pos/t5692b/Macros_1.scala
diff --git a/test/files/neg/t5692b/Test_2.scala b/test/files/pos/t5692b/Test_2.scala
index 08d510cc6f..08d510cc6f 100644
--- a/test/files/neg/t5692b/Test_2.scala
+++ b/test/files/pos/t5692b/Test_2.scala