New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nullary returntype-refining whitebox macros sometimes can't be applied #7914
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7914?orig=1 |
@xeno-by said: if (tree.isType)
adaptType()
else if (mode.typingExprNotFun && treeInfo.isMacroApplication(tree))
macroExpandApply(this, tree, mode, pt)
else if (mode.typingConstructorPattern)
typedConstructorPattern(tree, pt)
else if (shouldInsertApply(tree)) // <----- THIS THING DOESN'T GET CALLED
insertApply()
else if (hasUndetsInMonoMode) { // (9)
assert(!context.inTypeConstructorAllowed, context) //@M
instantiatePossiblyExpectingUnit(tree, mode, pt)
}
else if (tree.tpe <:< pt)
tree
else
fallbackAfterVanillaAdapt() Looks like to fix the bug we'll need to move the def applyPossible = {
def applyMeth = member(adaptToName(tree, nme.apply), nme.apply)
def hasPolymorphicApply = applyMeth.alternatives exists (_.tpe.typeParams.nonEmpty)
def hasMonomorphicApply = applyMeth.alternatives exists (_.tpe.paramSectionCount > 0)
dyna.acceptsApplyDynamic(tree.tpe) || (
if (mode.inTappMode)
tree.tpe.typeParams.isEmpty && hasPolymorphicApply
else
hasMonomorphicApply
)
}
def shouldInsertApply(tree: Tree) = mode.typingExprFun && {
tree.tpe match {
case _: MethodType | _: OverloadedType | _: PolyType => false
case _ => applyPossible
}
} |
@xeno-by said: |
The text was updated successfully, but these errors were encountered: