File tree Expand file tree Collapse file tree 2 files changed +7
-19
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +7
-19
lines changed Original file line number Diff line number Diff line change @@ -4013,6 +4013,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
40134013 cpy.Select (qual)(pre, name.toTypeName)
40144014 case qual : This if qual.symbol.is(ModuleClass ) =>
40154015 cpy.Ident (qual)(qual.symbol.name.sourceModuleName.toTypeName)
4016+ case _ =>
4017+ errorTree(tree, em " cannot convert to $tree to an instance creation expression " )
40164018 val tycon = tree.tpe.widen.finalResultType.underlyingClassRef(refinementOK = false )
40174019 typed(
40184020 untpd.Select (
Original file line number Diff line number Diff line change 11package x
22
3- import scala .annotation .*
43import scala .concurrent .*
54
6- @ capability
7- class CpsTransform [F [_]] {
8- def await [T ](ft : F [T ]): { this } T = ???
9- }
10-
11- inline def cpsAsync [F [_]] =
5+ def cpsAsync [F [_]] =
126 Test .InfernAsyncArg
13- object Test {
147
8+ object Test {
159 class InfernAsyncArg [F [_]] {
16- def apply [A ](expr : CpsTransform [ F ] ?=> A ): F [A ] = ???
10+ def apply [A ](): F [A ] = ???
1711 }
18-
19- def asyncPlus [F [_]](a: Int , b: F [Int ])(using cps : CpsTransform [F ]): { cps } Int =
20- a + cps.await(b)
12+ object InfernAsyncArg
2113
2214 def testExample1Future (): Unit =
23- val fr = cpsAsync[Future ] {
24- val y = asyncPlus(1 ,Future successful 2 )
25- y+ 1
26- }
27- val r = Await .result(fr)
28- assert(r == Success (3 ))
29-
15+ val fr = cpsAsync[Future ]() // error
3016}
You can’t perform that action at this time.
0 commit comments