Skip to content

Commit

Permalink
Avoid crash where creator proxies are referenced indirectly (#16098)
Browse files Browse the repository at this point in the history
Fixes #16095
  • Loading branch information
odersky authored Sep 26, 2022
2 parents 709a02a + 873338e commit 8b05e78
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4013,6 +4013,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
cpy.Select(qual)(pre, name.toTypeName)
case qual: This if qual.symbol.is(ModuleClass) =>
cpy.Ident(qual)(qual.symbol.name.sourceModuleName.toTypeName)
case _ =>
errorTree(tree, em"cannot convert from $tree to an instance creation expression")
val tycon = tree.tpe.widen.finalResultType.underlyingClassRef(refinementOK = false)
typed(
untpd.Select(
Expand Down
16 changes: 16 additions & 0 deletions tests/neg/i16095.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package x

import scala.concurrent.*

def cpsAsync[F[_]] =
Test.InfernAsyncArg

object Test {
class InfernAsyncArg[F[_]] {
def apply[A](): F[A] = ???
}
object InfernAsyncArg

def testExample1Future(): Unit =
val fr = cpsAsync[Future]() // error
}

0 comments on commit 8b05e78

Please sign in to comment.