Skip to content

Nothing inferred for path dependent type parameter #8991

Open
@bishabosha

Description

@bishabosha

Minimized code

object Macros {

  abstract class Universe {
    trait WeakTypeTag[T]
    object WeakTypeTag {
      implicit val IntTag: WeakTypeTag[Int] = ???
    }
  }

  trait Context {
    val universe: Universe
  }

  class MacroImpl(val c: Context) {
    import c.universe._
    def poly[T: WeakTypeTag]: Any = ???
  }

  def test1 = new MacroImpl(???).poly[Int]

}

Output

-- Error: MacroBundleTasty.scala:19:42 
19 |  def test1 = new MacroImpl(???).poly[Int]
   |                                          ^
   |no implicit argument of type Nothing was found for an implicit parameter of method poly in class MacroImpl
1 error found

Expectation

This should compile as it does with Scala 2.13.2
This is also critical to support macro compatibility with macro bundles

The alternative below compiles, but the signature in TASTy for MacroImpl.poly is poly[Signed Signature(List(1, scala.Nothing),Macros$.Universe.Tree)], which is incorrect

object Macros {

  abstract class Universe {
    trait WeakTypeTag[T]
  }

  trait Context {
    val universe: Universe
  }

  class MacroImpl(val c: Context) {
    import c.universe._
    def poly[T: WeakTypeTag]: Any = ???
  }

  def test1 = new MacroImpl(???).poly[Int](???)

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions