File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -893,11 +893,14 @@ trait Applications extends Compatibility {
893893
894894 def realApply (using Context ): Tree = {
895895 val resultProto = tree.fun match
896- case Select (New (_), _) if pt.isInstanceOf [ValueType ] => pt
897- // Don't ignore expected value types of `new` expressions. If we have a `new C()`
898- // with expected type `C[T]` we want to use the type to instantiate `C`
899- // immediately. This is necessary since `C` might _also_ have using clauses
900- // that we want to instantiate with the best available type. See i15664.scala.
896+ case Select (New (tpt), _) if pt.isInstanceOf [ValueType ] =>
897+ if tpt.isType && typedAheadType(tpt).tpe.typeSymbol.typeParams.isEmpty then
898+ IgnoredProto (pt)
899+ else
900+ pt // Don't ignore expected value types of `new` expressions with parameterized type.
901+ // If we have a `new C()` with expected type `C[T]` we want to use the type to
902+ // instantiate `C` immediately. This is necessary since `C` might _also_ have using
903+ // clauses that we want to instantiate with the best available type. See i15664.scala.
901904 case _ => IgnoredProto (pt)
902905 // Do ignore other expected result types, since there might be an implicit conversion
903906 // on the result. We could drop this if we disallow unrestricted implicit conversions.
Original file line number Diff line number Diff line change 1+ sealed trait ZIO [- R , + E , + A ]
2+ object ZIO {
3+ def fail [E ](error : E ): ZIO [Any , E , Nothing ] = ???
4+ }
5+
6+ trait Endpoint [INPUT , ERROR_OUTPUT , OUTPUT ]{
7+ sealed trait ZServerEndpoint [R ]
8+ def zServerLogic [R ](logic : INPUT => ZIO [R , ERROR_OUTPUT , OUTPUT ]): ZServerEndpoint [R ] = ???
9+ }
10+
11+ @ main def Test () =
12+ val x : Endpoint [_, Unit , Unit ] = ???
13+ x.zServerLogic[Any ](_ => ZIO .fail(new RuntimeException (" boom" )))
You can’t perform that action at this time.
0 commit comments