From 0a24981d0a71627e541d283b9f739e09a7eab550 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Wed, 25 Apr 2012 13:30:51 +0300 Subject: fixes SI-5706 --- src/compiler/scala/tools/nsc/typechecker/Macros.scala | 1 + test/files/pos/t5706.flags | 1 + test/files/pos/t5706.scala | 10 ++++++++++ 3 files changed, 12 insertions(+) create mode 100644 test/files/pos/t5706.flags create mode 100644 test/files/pos/t5706.scala diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index 5d4cd0be77..4e4c52e0f7 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -388,6 +388,7 @@ trait Macros { self: Analyzer => compatibilityError("types incompatible for parameter "+aparam.name+": corresponding is not a vararg parameter") if (!hasErrors) { var atpe = aparam.tpe.substSym(flatactparams, flatreqparams).instantiateTypeParams(tparams, tvars) + atpe = atpe.dealias // SI-5706 // strip the { type PrefixType = ... } refinement off the Context or otherwise we get compatibility errors atpe = atpe match { case RefinedType(List(tpe), Scope(sym)) if tpe == MacroContextClass.tpe && sym.allOverriddenSymbols.contains(MacroContextPrefixType) => tpe diff --git a/test/files/pos/t5706.flags b/test/files/pos/t5706.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/pos/t5706.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/test/files/pos/t5706.scala b/test/files/pos/t5706.scala new file mode 100644 index 0000000000..847acb693f --- /dev/null +++ b/test/files/pos/t5706.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.Context + +class Logger { + def error(message: String) = macro Impls.error +} + +object Impls { + type LoggerContext = Context { type PrefixType = Logger } + def error(c: LoggerContext)(message: c.Expr[String]): c.Expr[Unit] = ??? +} -- cgit v1.2.3