Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3539,14 +3539,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
val namedArgs = wtp.paramNames.lazyZip(args).flatMap { (pname, arg) =>
if (arg.tpe.isError) Nil else untpd.NamedArg(pname, untpd.TypedSplice(arg)) :: Nil
}
tryEither {
val app = cpy.Apply(tree)(untpd.TypedSplice(tree), namedArgs)
if (wtp.isContextualMethod) app.setApplyKind(ApplyKind.Using)
typr.println(i"try with default implicit args $app")
typed(app, pt, locked)
} { (_, _) =>
issueErrors()
}
val app = cpy.Apply(tree)(untpd.TypedSplice(tree), namedArgs)
if (wtp.isContextualMethod) app.setApplyKind(ApplyKind.Using)
typr.println(i"try with default implicit args $app")
typed(app, pt, locked)
else issueErrors()
}
else tree match {
Expand Down
9 changes: 0 additions & 9 deletions tests/neg/i14772.check
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,3 @@
| Overloaded or recursive method impl needs return type
|
| longer explanation available when compiling with `-explain`
-- Error: tests/neg/i14772.scala:8:12 ----------------------------------------------------------------------------------
8 | Expr(()) // error
| ^
| no given instance of type quoted.ToExpr[Unit] was found for parameter x$2 of method apply in object Expr.
| I found:
|
| quoted.ToExpr.ClassToExpr[T]
|
| But given instance ClassToExpr in object ToExpr does not match type quoted.ToExpr[Unit].
2 changes: 1 addition & 1 deletion tests/neg/i14772.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ object A {

def impl(a: Expr[Any])(using Quotes)/*: Expr[Any]*/ = {
foo(a) // error
Expr(()) // error
???
}
}
7 changes: 7 additions & 0 deletions tests/neg/i14842.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- [E007] Type Mismatch Error: tests/neg/i14842.scala:11:35 ------------------------------------------------------------
11 | val x: Either[Int, Any] = node.as[Any] // error
| ^^^^^^^^^^^^
| Found: Either[String, Any]
| Required: Either[Int, Any]
|
| longer explanation available when compiling with `-explain`
12 changes: 12 additions & 0 deletions tests/neg/i14842.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Dummy
object Dummy:
val empty = new Dummy

sealed trait Node:
def as[T](using d: Dummy = Dummy.empty): Either[String, T] = ???

object Sample extends App {
val node: Node = ???

val x: Either[Int, Any] = node.as[Any] // error
}