scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.72k stars 1.04k forks source link

private inline method leads to type path loss #20587

Open Bersier opened 3 weeks ago

Bersier commented 3 weeks ago

Compiler version

3.5.0-RC1

Minimized code

class A:
  def foo(i: Int): Any = inlineFoo(0)

  inline def inlineFoo(inline i: Int): Any = new Object:
    def left: B = inlineB(i)

  private inline def inlineB(inline i: Int): B = B()

  class B

Compiler output

Found:    A#B
Required: A.this.B

Expectation

No compile-error, as when private is removed.

EugeneFlesselle commented 2 weeks ago

Minimized:

class A:
  class B

  private inline def inlineB: B = B()

  inline def inlineU: Unit =
    val b: B = inlineB

  inlineU // error