diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-07-10 17:15:54 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-07-10 17:15:54 -0700 |
commit | 8b41240f3d532c470112d7bf1f409badac4d56aa (patch) | |
tree | 7e071c8f0270d1a115f6eb2177674e260efb5651 /src | |
parent | 7125dc3e2c8e996f956bba08201c24e458391c12 (diff) | |
parent | be393913a822456683a57c747965f7ee80a2a537 (diff) | |
download | scala-8b41240f3d532c470112d7bf1f409badac4d56aa.tar.gz scala-8b41240f3d532c470112d7bf1f409badac4d56aa.tar.bz2 scala-8b41240f3d532c470112d7bf1f409badac4d56aa.zip |
Merge pull request #2720 from adriaanm/ticket-7487v2.11.0-M4
SI-7487 Revert "Removed -Ymacro-no-expand."
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/ScalaSettings.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala | 22 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 993f735c72..32f0571e83 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -166,6 +166,7 @@ trait ScalaSettings extends AbsScalaSettings val Yrangepos = BooleanSetting ("-Yrangepos", "Use range positions for syntax trees.") val Ymemberpos = StringSetting ("-Yshow-member-pos", "output style", "Show start and end positions of members", "") withPostSetHook (_ => Yrangepos.value = true) val Yreifycopypaste = BooleanSetting ("-Yreify-copypaste", "Dump the reified trees in copypasteable representation.") + val Ymacronoexpand = BooleanSetting ("-Ymacro-no-expand", "Don't expand macros. Might be useful for scaladoc and presentation compiler, but will crash anything which uses macros and gets past typer.") val Yreplsync = BooleanSetting ("-Yrepl-sync", "Do not use asynchronous code for repl startup") val Yreploutdir = StringSetting ("-Yrepl-outdir", "path", "Write repl-generated classfiles to given output directory (use \"\" to generate a temporary dir)" , "") val YmethodInfer = BooleanSetting ("-Yinfer-argument-types", "Infer types for arguments of overriden methods.") diff --git a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala index c616ded704..bbd51b5564 100644 --- a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala +++ b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala @@ -100,15 +100,17 @@ trait StdAttachments { /** Determines whether a tree should not be expanded, because someone has put SuppressMacroExpansionAttachment on it or one of its children. */ def isMacroExpansionSuppressed(tree: Tree): Boolean = - if (tree.attachments.get[SuppressMacroExpansionAttachment.type].isDefined) true - else tree match { - // we have to account for the fact that during typechecking an expandee might become wrapped, - // i.e. surrounded by an inferred implicit argument application or by an inferred type argument application. - // in that case the expandee itself will no longer be suppressed and we need to look at the core - case Apply(fn, _) => isMacroExpansionSuppressed(fn) - case TypeApply(fn, _) => isMacroExpansionSuppressed(fn) - case _ => false - } + ( settings.Ymacronoexpand.value // SI-6812 + || tree.attachments.get[SuppressMacroExpansionAttachment.type].isDefined + || (tree match { + // we have to account for the fact that during typechecking an expandee might become wrapped, + // i.e. surrounded by an inferred implicit argument application or by an inferred type argument application. + // in that case the expandee itself will no longer be suppressed and we need to look at the core + case Apply(fn, _) => isMacroExpansionSuppressed(fn) + case TypeApply(fn, _) => isMacroExpansionSuppressed(fn) + case _ => false + }) + ) /** After being synthesized by the parser, primary constructors aren't fully baked yet. * A call to super in such constructors is just a fill-me-in-later dummy resolved later @@ -154,4 +156,4 @@ trait StdAttachments { * because someone has put MacroImplRefAttachment on it. */ def isMacroImplRef(tree: Tree): Boolean = tree.attachments.get[MacroImplRefAttachment.type].isDefined -}
\ No newline at end of file +} |