Skip to content

TypeMismatchError compiling inline infix method with this #11866

Closed
@japgolly

Description

@japgolly

Compiler version

3.0.0-RC1

Minimized code

type Callback = CallbackTo[Unit]

final class CallbackTo[+A] { self =>

  def >>[B](y: CallbackTo[B]): CallbackTo[B] =
    ???

  inline def *>[B](z: CallbackTo[B]): CallbackTo[B] =
    >>(z)

  def qwe: CallbackTo[A] = {
    def x: Callback = ???
    val hmmm = this

    x *> this // error
    x *> self // error
    x *> hmmm // ok

    ???
  }
}

Output

-- [E007] Type Mismatch Error: x.scala:15:4 ------------------------------------
15 |    x *> this // error
   |    ^^^^^^^^^
   |    Found:    (CallbackTo_this : Callback)
   |    Required: CallbackTo[A]
-- [E007] Type Mismatch Error: x.scala:16:4 ------------------------------------
16 |    x *> self // error
   |    ^^^^^^^^^
   |    Found:    (CallbackTo_this : Callback)
   |    Required: CallbackTo[A]

Expectation

It should compile.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions