File tree Expand file tree Collapse file tree 5 files changed +24
-18
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 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
35393539 val namedArgs = wtp.paramNames.lazyZip(args).flatMap { (pname, arg) =>
35403540 if (arg.tpe.isError) Nil else untpd.NamedArg (pname, untpd.TypedSplice (arg)) :: Nil
35413541 }
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)
35503546 else issueErrors()
35513547 }
35523548 else tree match {
Original file line number Diff line number Diff line change 44 | Overloaded or recursive method impl needs return type
55 |
66 | 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 {
55
66 def impl (a : Expr [Any ])(using Quotes )/* : Expr[Any]*/ = {
77 foo(a) // error
8- Expr (()) // error
8+ ???
99 }
1010}
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