File tree 2 files changed +11
-21
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +11
-21
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 (
@@ -4022,7 +4024,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
4022
4024
.showing(i " convert creator $tree -> $result" , typr)
4023
4025
4024
4026
def isApplyProxy (tree : Tree ) = tree match
4025
- case Select (_ , nme.apply) => tree.symbol.isAllOf(ApplyProxyFlags )
4027
+ case Select (qual , nme.apply) => tree.symbol.isAllOf(ApplyProxyFlags )
4026
4028
case _ => false
4027
4029
4028
4030
tree match {
@@ -4040,7 +4042,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
4040
4042
adaptOverloaded(ref)
4041
4043
}
4042
4044
case poly : PolyType if ! (ctx.mode is Mode .Type ) =>
4043
- if isApplyProxy(tree) then newExpr
4045
+ if isApplyProxy(tree) then
4046
+ println(i " converting app proxy $tree" )
4047
+ newExpr
4044
4048
else if pt.isInstanceOf [PolyProto ] then tree
4045
4049
else
4046
4050
var typeArgs = tree match
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