summaryrefslogtreecommitdiff
path: root/test/files/neg/macro-override-macro-overrides-abstract-method-b.check
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-07-14 02:58:29 +0200
committerEugene Burmako <xeno.by@gmail.com>2013-07-14 02:58:29 +0200
commitef979c02da887b7c56bc1da9c4eb888e92af570f (patch)
tree2e105d3a0c3374875bede127dd6afaf7a1c88715 /test/files/neg/macro-override-macro-overrides-abstract-method-b.check
parent2247593472031fd9712b652bab0b978a788e46ef (diff)
downloadscala-ef979c02da887b7c56bc1da9c4eb888e92af570f.tar.gz
scala-ef979c02da887b7c56bc1da9c4eb888e92af570f.tar.bz2
scala-ef979c02da887b7c56bc1da9c4eb888e92af570f.zip
SI-7657 clarifies the "macro overrides method" rule
Currently we allow macros to override non-abstract methods (in order to provide performance enhancements such as foreach for collections), and we also disallow macros to override abstract methods (otherwise downcasting might lead to AbstractMethodErrors). This patch fixes an oversight in the disallowing rule that prohibited macros from overriding a concrete method if that concrete method itself overrides an abstract method. RefCheck entertains all overriding pairs, not only the immediate ones, so the disallowing rule was triggered. Now macros can override abstract methods if and only if either the base type or the self type contain a matching non-abstract method.
Diffstat (limited to 'test/files/neg/macro-override-macro-overrides-abstract-method-b.check')
-rw-r--r--test/files/neg/macro-override-macro-overrides-abstract-method-b.check16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-b.check b/test/files/neg/macro-override-macro-overrides-abstract-method-b.check
index 895e0dca50..cde3dbdbe8 100644
--- a/test/files/neg/macro-override-macro-overrides-abstract-method-b.check
+++ b/test/files/neg/macro-override-macro-overrides-abstract-method-b.check
@@ -1,5 +1,11 @@
-Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int;
- macro method foo cannot override an abstract method
- def foo(x: Int) = macro Impls.impl
- ^
-one error found
+Test_2.scala:3: error: anonymous class $anon inherits conflicting members:
+ macro method t in trait C of type ()Unit and
+ method t in trait A of type ()Unit
+(Note: this can be resolved by declaring an override in anonymous class $anon.)
+ val c2 = new C with A {}
+ ^
+Test_2.scala:5: error: overriding macro method t in trait C of type ()Unit;
+ method t cannot override a macro
+ val c4 = new C with A { override def t(): Unit = () }
+ ^
+two errors found