Skip to content

Set of case objects defined inside a class returns empty  #8

@asafl

Description

@asafl

Hi,

First of all: amazing macro, it really helps get rid of large amounts of code.

Second, I wondered if there was a way to make it iterate over case objects of a sealed abstract class within another sealed abstract class.
At the moment, running it within the "main" abstract class generates an empty Set. Running it outside the "main" abstract class will generate a type mismatch error.
Example code:

sealed abstract class MainClass {
    val mainData: Seq[Int] = Seq(1,2,3,4,5)
    val allColuserdCaseObjects: Set[ClosuredClass] = sealerate.values[ClosuredClass]

    sealed abstract class ClosuredClass {
        lazy val closuredData: Int = mainData.length
    }
}

I would like to get a Set for all the MainClass case objects if running outside of MainClass, and a Set of all ClosuredClass case objects if running within the MainClass (see allClosuredCaseObjects variable).

Thanks
Asaf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions