SealedTrait

zio.blocks.codegen.ir.SealedTrait
final case class SealedTrait(name: String, typeParams: List[TypeParam] = ..., extendsTypes: List[TypeRef] = ..., cases: List[SealedTraitCase] = ..., derives: List[String] = ..., annotations: List[Annotation] = ..., companion: Option[CompanionObject] = ..., doc: Option[String] = ..., selfType: Option[TypeRef] = ...) extends TypeDefinition

Represents a Scala sealed trait in the IR.

Value parameters

annotations

Annotations on the sealed trait (defaults to empty list)

cases

The cases (subtypes) of the sealed trait (defaults to empty list)

companion

Optional companion object (defaults to None)

doc

Optional documentation (defaults to None)

extendsTypes

Types that this sealed trait extends (defaults to empty list)

name

The name of the sealed trait

typeParams

Type parameters for generic sealed traits (defaults to empty list)

Attributes

Example
val shape = SealedTrait(
 "Shape",
 cases = List(
   SealedTraitCase.CaseClassCase(CaseClass("Circle", List(Field("radius", TypeRef.Double)))),
   SealedTraitCase.CaseObjectCase("Unknown")
 )
)
Source
TypeDefinition.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala