Skip to content
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

Avoid crash where creator proxies are referenced indirectly #16098

Merged
merged 3 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 to $tree to an instance creation expression")
odersky marked this conversation as resolved.
Show resolved Hide resolved
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
}