Skip to content

Commit b31b7bd

Browse files
committed
Fix isConversionTargetType test
Was wrong for annotated types before. Fixes #23398
1 parent 2d11d4c commit b31b7bd

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ object Types extends TypeUtils {
472472
case tp: TypeRef =>
473473
(tp.symbol.isClass || tp.symbol.isOpaqueAlias) && tp.symbol.is(Into)
474474
case tp @ AppliedType(tycon, _) =>
475-
isInto || tycon.isConversionTargetType
475+
tp.isInto || tycon.isConversionTargetType
476476
case tp: AndOrType =>
477477
tp.tp1.isConversionTargetType && tp.tp2.isConversionTargetType
478478
case tp: TypeVar =>

tests/pos/i23398.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//> using options -feature -Werror
2+
import scala.language.experimental.into
3+
import Conversion.into
4+
5+
case class Foo(x: Int)
6+
7+
given Conversion[Int, Foo] = Foo(_)
8+
9+
def takeFoo(f: into[Foo]) = f
10+
inline def inlineTakeFoo(f: into[Foo]) = f
11+
inline def takeInlineFoo(inline f: into[Foo]) = f
12+
13+
def test =
14+
val f1 = takeFoo(1)
15+
val f2 = inlineTakeFoo(1)
16+
val f3 = takeInlineFoo(1)

0 commit comments

Comments
 (0)