File tree 2 files changed +7
-19
lines changed
compiler/src/dotty/tools/dotc/typer
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
4013
4013
cpy.Select (qual)(pre, name.toTypeName)
4014
4014
case qual : This if qual.symbol.is(ModuleClass ) =>
4015
4015
cpy.Ident (qual)(qual.symbol.name.sourceModuleName.toTypeName)
4016
+ case _ =>
4017
+ errorTree(tree, em " cannot convert to $tree to an instance creation expression " )
4016
4018
val tycon = tree.tpe.widen.finalResultType.underlyingClassRef(refinementOK = false )
4017
4019
typed(
4018
4020
untpd.Select (
Original file line number Diff line number Diff line change 1
1
package x
2
2
3
- import scala .annotation .*
4
3
import scala .concurrent .*
5
4
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 [_]] =
12
6
Test .InfernAsyncArg
13
- object Test {
14
7
8
+ object Test {
15
9
class InfernAsyncArg [F [_]] {
16
- def apply [A ](expr : CpsTransform [ F ] ?=> A ): F [A ] = ???
10
+ def apply [A ](): F [A ] = ???
17
11
}
18
-
19
- def asyncPlus [F [_]](a: Int , b: F [Int ])(using cps : CpsTransform [F ]): { cps } Int =
20
- a + cps.await(b)
12
+ object InfernAsyncArg
21
13
22
14
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
30
16
}
You can’t perform that action at this time.
0 commit comments