softwaremill / magnolia

Easy, fast, transparent generic derivation of typeclass instances
https://softwaremill.com/open-source/
Apache License 2.0
754 stars 116 forks source link

typeinfo is error-prone #475

Open OlegYch opened 1 year ago

OlegYch commented 1 year ago

given code like this on "com.softwaremill.magnolia1_3" %% "magnolia" % "1.3.2"

def f[T] = magnolia1.Macro.typeInfo[T]
f[List[Int]]

i get TypeInfo(Playground.f,T,List()) instead this should either not compile or produce TypeInfo(scala.collection.immutable,List,List(TypeInfo(scala,Int,List())))

compare this to TypeTag behaviour on scala2:

type TypeTag[T] = scala.reflect.runtime.universe.TypeTag[T]
def f[T:TypeTag] = implicitly[TypeTag[T]]
f[List[Int]]

correctly returns TypeTag[List[Int]] or doesn't compile if you forget :TypeTag bound