File tree 5 files changed +24
-18
lines changed
compiler/src/dotty/tools/dotc/typer 5 files changed +24
-18
lines changed Original file line number Diff line number Diff line change @@ -3539,14 +3539,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
3539
3539
val namedArgs = wtp.paramNames.lazyZip(args).flatMap { (pname, arg) =>
3540
3540
if (arg.tpe.isError) Nil else untpd.NamedArg (pname, untpd.TypedSplice (arg)) :: Nil
3541
3541
}
3542
- tryEither {
3543
- val app = cpy.Apply (tree)(untpd.TypedSplice (tree), namedArgs)
3544
- if (wtp.isContextualMethod) app.setApplyKind(ApplyKind .Using )
3545
- typr.println(i " try with default implicit args $app" )
3546
- typed(app, pt, locked)
3547
- } { (_, _) =>
3548
- issueErrors()
3549
- }
3542
+ val app = cpy.Apply (tree)(untpd.TypedSplice (tree), namedArgs)
3543
+ if (wtp.isContextualMethod) app.setApplyKind(ApplyKind .Using )
3544
+ typr.println(i " try with default implicit args $app" )
3545
+ typed(app, pt, locked)
3550
3546
else issueErrors()
3551
3547
}
3552
3548
else tree match {
Original file line number Diff line number Diff line change 4
4
| Overloaded or recursive method impl needs return type
5
5
|
6
6
| longer explanation available when compiling with `-explain`
7
- -- Error: tests/neg/i14772.scala:8:12 ----------------------------------------------------------------------------------
8
- 8 | Expr(()) // error
9
- | ^
10
- | no given instance of type quoted.ToExpr[Unit] was found for parameter x$2 of method apply in object Expr.
11
- | I found:
12
- |
13
- | quoted.ToExpr.ClassToExpr[T]
14
- |
15
- | But given instance ClassToExpr in object ToExpr does not match type quoted.ToExpr[Unit].
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ object A {
5
5
6
6
def impl (a : Expr [Any ])(using Quotes )/* : Expr[Any]*/ = {
7
7
foo(a) // error
8
- Expr (()) // error
8
+ ???
9
9
}
10
10
}
Original file line number Diff line number Diff line change
1
+ -- [E007] Type Mismatch Error: tests/neg/i14842.scala:11:35 ------------------------------------------------------------
2
+ 11 | val x: Either[Int, Any] = node.as[Any] // error
3
+ | ^^^^^^^^^^^^
4
+ | Found: Either[String, Any]
5
+ | Required: Either[Int, Any]
6
+ |
7
+ | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change
1
+ class Dummy
2
+ object Dummy :
3
+ val empty = new Dummy
4
+
5
+ sealed trait Node :
6
+ def as [T ](using d : Dummy = Dummy .empty): Either [String , T ] = ???
7
+
8
+ object Sample extends App {
9
+ val node : Node = ???
10
+
11
+ val x : Either [Int , Any ] = node.as[Any ] // error
12
+ }
You can’t perform that action at this time.
0 commit comments