Skip to content

[SIP-71] into does not work for inline parameters #23398

Open
@prolativ

Description

@prolativ

Compiler version

3.7.3-RC1-bin-20250619-b1da8fc-NIGHTLY

Minimized code

import scala.language.experimental.into
import Conversion.into

case class Foo(x: Int)

given Conversion[Int, Foo] = Foo(_)

def takeFoo(f: into[Foo]) = f
inline def inlineTakeFoo(f: into[Foo]) = f
inline def takeInlineFoo(inline f: into[Foo]) = f

def test = 
  val f1 = takeFoo(1)
  val f2 = inlineTakeFoo(1)
  val f3 = takeInlineFoo(1)

Output

(Compiling with -feature flag for more detailed explanation)

[warn] Use of implicit conversion given instance given_Conversion_Int_Foo should be enabled
[warn] by adding the import clause 'import scala.language.implicitConversions'
[warn] or by setting the compiler option -language:implicitConversions.
[warn] See the Scala docs for value scala.language.implicitConversions for a discussion
[warn] why the feature should be explicitly enabled.
[warn]   val f3 = takeInlineFoo(1)
[warn]                          ^

Expectation

The code should compile without a warning. In general, making a method parameter inline should not influence the behaviour of the check for allowed implicit conversions

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions