Skip to content

cannot reify abstract vals #6023

@scabug

Description

@scabug

There are a lot of tickets about things which can't be reified so this could easily be a duplicate, but I don't see the right one, so:

scala> reflect.runtime.universe.reify { trait Foo { val a: Int } }
<console>:8: error: exception during macro expansion: 
java.lang.Error: unexpected: bound type that doesn't have a tpe: Ident(newTypeName("Int"))
	at scala.reflect.reify.codegen.GenTrees$class.reifyBoundType$1(GenTrees.scala:154)
	at scala.reflect.reify.codegen.GenTrees$class.reifyBoundType(GenTrees.scala:203)
	at scala.reflect.reify.codegen.GenTrees$class.reifyTree(GenTrees.scala:56)
	at scala.reflect.reify.Reifier.reifyTree(Reifier.scala:14)
	at scala.reflect.reify.phases.Reify$$anonfun$reify$1.apply(Reify.scala:46)

No complaints about an abstract def:

res1: reflect.runtime.universe.Expr[Unit] = 
Expr[Unit]({
  abstract trait Foo extends Object {
    def a: Int
  };
  ()
})

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions