Skip to content

Commit

Permalink
Inhibit typer to insert contextual parameters into hoas pattern argum…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
zeptometer committed Jun 25, 2023
1 parent 9830a3e commit fe04dae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ trait QuotesAndSplices {
if (ctx.mode.is(Mode.QuotedPattern)) patternOuterContext(ctx.outer) else ctx
val typedArgs = tree.args.map {
case arg: untpd.Ident =>
typedExpr(arg)
withoutMode(Mode.ImplicitsEnabled)(typedExpr(arg))
case arg =>
report.error("Open pattern expected an identifier", arg.srcPos)
EmptyTree
Expand Down
8 changes: 7 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4055,12 +4055,18 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
case _: SingletonType | _: FunOrPolyProto => false
case _ => true
var resMatch: Boolean = false
// println(i"adaptNoArgs: tree = ${tree}")
// println(i"adaptNoArgs: ctx.mode = ${ctx.mode}")
// println(i"adaptNoArgs: ptNorm = ${ptNorm}")
// println(i"functionExpected = ${functionExpected}")
// println(i"needsEta = ${needsEta}")
wtp match {
case wtp: ExprType =>
readaptSimplified(tree.withType(wtp.resultType))
case wtp: MethodType if wtp.isImplicitMethod &&
ctx.mode.is(Mode.ImplicitsEnabled) &&
({ resMatch = constrainResult(tree.symbol, wtp, sharpenedPt); resMatch } || !functionExpected) =>
if (resMatch || ctx.mode.is(Mode.ImplicitsEnabled))
if (resMatch)
adaptNoArgsImplicitMethod(wtp)
else
// Don't proceed with implicit search if result type cannot match - the search
Expand Down

0 comments on commit fe04dae

Please sign in to comment.