diff --git a/core/src/fr/hammons/slinc/CUnion.scala b/core/src/fr/hammons/slinc/CUnion.scala index d4dd67a5..fa0296fb 100644 --- a/core/src/fr/hammons/slinc/CUnion.scala +++ b/core/src/fr/hammons/slinc/CUnion.scala @@ -7,7 +7,7 @@ import fr.hammons.slinc.modules.ReadWriteModule import fr.hammons.slinc.modules.DescriptorModule import scala.NonEmptyTuple -class CUnion[T <: Tuple](mem: Mem): +class CUnion[T <: Tuple](private[slinc] val mem: Mem): private inline def getHelper[T <: Tuple, A](using dO: DescriptorOf[A], rwm: ReadWriteModule diff --git a/core/src/fr/hammons/slinc/DescriptorOf.scala b/core/src/fr/hammons/slinc/DescriptorOf.scala index e623bc6d..33d1bbf8 100644 --- a/core/src/fr/hammons/slinc/DescriptorOf.scala +++ b/core/src/fr/hammons/slinc/DescriptorOf.scala @@ -2,6 +2,8 @@ package fr.hammons.slinc import fr.hammons.slinc.container.* import scala.quoted.* +import scala.compiletime.{summonInline, erasedValue} +import scala.NonEmptyTuple /** Typeclass that summons TypeDescriptors */ @@ -64,3 +66,14 @@ object DescriptorOf: ) '{ $expr.descriptor } + + private inline def helper[B <: Tuple]: Set[TypeDescriptor] = + inline erasedValue[B] match + case _: (a *: t) => helper[t] + summonInline[DescriptorOf[a]].descriptor + case _: EmptyTuple => Set.empty[TypeDescriptor] + + inline given [A <: NonEmptyTuple]: DescriptorOf[CUnion[A]] = + new DescriptorOf[CUnion[A]]: + val descriptor: CUnionDescriptor { type Inner = CUnion[A] } = + CUnionDescriptor(helper[A]) + .asInstanceOf[CUnionDescriptor { type Inner = CUnion[A] }] diff --git a/core/src/fr/hammons/slinc/MacroHelpers.scala b/core/src/fr/hammons/slinc/MacroHelpers.scala index cdce3bf5..2cc17915 100644 --- a/core/src/fr/hammons/slinc/MacroHelpers.scala +++ b/core/src/fr/hammons/slinc/MacroHelpers.scala @@ -1,8 +1,6 @@ package fr.hammons.slinc import scala.quoted.* -import scala.annotation.nowarn - private[slinc] object MacroHelpers: def widenExpr(t: Expr[?])(using Quotes) = import quotes.reflect.* diff --git a/core/src/fr/hammons/slinc/Mem.scala b/core/src/fr/hammons/slinc/Mem.scala index e6c03e60..b2da4e97 100644 --- a/core/src/fr/hammons/slinc/Mem.scala +++ b/core/src/fr/hammons/slinc/Mem.scala @@ -1,7 +1,5 @@ package fr.hammons.slinc -import scala.annotation.nowarn - trait Mem: import scala.compiletime.asMatchable def offset(bytes: Bytes): Mem diff --git a/core/src/fr/hammons/slinc/MethodHandleTools.scala b/core/src/fr/hammons/slinc/MethodHandleTools.scala index a8a47aa5..beaf07e8 100644 --- a/core/src/fr/hammons/slinc/MethodHandleTools.scala +++ b/core/src/fr/hammons/slinc/MethodHandleTools.scala @@ -3,7 +3,6 @@ package fr.hammons.slinc import scala.quoted.* import java.lang.invoke.MethodHandle import fr.hammons.slinc.modules.TransitionModule -import scala.annotation.nowarn object MethodHandleTools: def exprNameMapping(expr: Expr[Any])(using Quotes): String = diff --git a/core/src/fr/hammons/slinc/SlincImpl.scala b/core/src/fr/hammons/slinc/SlincImpl.scala index 13c7226a..1185da53 100644 --- a/core/src/fr/hammons/slinc/SlincImpl.scala +++ b/core/src/fr/hammons/slinc/SlincImpl.scala @@ -2,7 +2,6 @@ package fr.hammons.slinc import scala.annotation.StaticAnnotation import scala.quoted.* -import scala.annotation.nowarn class SlincImpl(val version: Int) extends StaticAnnotation diff --git a/core/src/fr/hammons/slinc/Struct.scala b/core/src/fr/hammons/slinc/Struct.scala index 26616aad..89c32a88 100644 --- a/core/src/fr/hammons/slinc/Struct.scala +++ b/core/src/fr/hammons/slinc/Struct.scala @@ -8,7 +8,6 @@ import fr.hammons.slinc.modules.TransitionModule import fr.hammons.slinc.modules.ReadWriteModule import fr.hammons.slinc.modules.Reader import fr.hammons.slinc.modules.Writer -import scala.annotation.nowarn trait Struct[A <: Product] extends DescriptorOf[A] @@ -110,12 +109,10 @@ object Struct: val reader = readGen[A] val writer = writeGen[A] - @nowarn("msg=unused implicit parameter") override val returnTransition = returnValue => val mem = summon[TransitionModule].memReturn(returnValue) summon[ReadWriteModule].read(mem, Bytes(0), this) - @nowarn("msg=unused implicit parameter") override val argumentTransition = argument => val mem = summon[Allocator].allocate(this, 1) summon[ReadWriteModule].write(mem, Bytes(0), this, argument) diff --git a/core/src/fr/hammons/slinc/TypeDescriptor.scala b/core/src/fr/hammons/slinc/TypeDescriptor.scala index 0107568d..4355e2e7 100644 --- a/core/src/fr/hammons/slinc/TypeDescriptor.scala +++ b/core/src/fr/hammons/slinc/TypeDescriptor.scala @@ -8,11 +8,11 @@ import fr.hammons.slinc.modules.{ ArrayReader, readWriteModule } -import scala.annotation.nowarn import scala.reflect.ClassTag import scala.quoted.* import fr.hammons.slinc.modules.TransitionModule import fr.hammons.slinc.modules.{ArgumentTransition, ReturnTransition} +import scala.NonEmptyTuple /** Describes types used by C interop */ @@ -106,31 +106,23 @@ case object LongDescriptor extends BasicDescriptor: case object FloatDescriptor extends BasicDescriptor: type Inner = Float - @nowarn("msg=unused implicit parameter") val reader = readWriteModule.floatReader - @nowarn("msg=unused implicit parameter") val writer = readWriteModule.floatWriter case object DoubleDescriptor extends BasicDescriptor: type Inner = Double - @nowarn("msg=unused implicit parameter") val reader = readWriteModule.doubleReader - @nowarn("msg=unused implicit parameter") val writer = readWriteModule.doubleWriter case object PtrDescriptor extends TypeDescriptor: type Inner = Ptr[?] - @nowarn("msg=unused implicit parameter") override val reader = (mem, offset) => Ptr(readWriteModule.memReader(mem, offset), Bytes(0)) - @nowarn("msg=unused implicit parameter") override val writer = (mem, offset, a) => readWriteModule.memWriter(mem, offset, a.mem) - @nowarn("msg=unused implicit parameter") override val argumentTransition = _.mem.asAddress - @nowarn("msg=unused implicit parameter") override val returnTransition = o => Ptr[Any](summon[TransitionModule].addressReturn(o), Bytes(0)) @@ -174,11 +166,9 @@ case class AliasDescriptor[A](val real: TypeDescriptor) extends TypeDescriptor: val writer: (ReadWriteModule, DescriptorModule) ?=> Writer[Inner] = (rwm, _) ?=> (mem, bytes, a) => rwm.write(mem, bytes, real, a) - @nowarn("msg=unused implicit parameter") override val argumentTransition = summon[TransitionModule].methodArgument(real, _, summon[Allocator]) - @nowarn("msg=unused implicit parameter") override val returnTransition = summon[TransitionModule].methodReturn(real, _) override def size(using dm: DescriptorModule): Bytes = dm.sizeOf(real) override def alignment(using dm: DescriptorModule): Bytes = @@ -189,22 +179,36 @@ case class AliasDescriptor[A](val real: TypeDescriptor) extends TypeDescriptor: case object VaListDescriptor extends TypeDescriptor: type Inner = VarArgs - @nowarn(TypeDescriptor.unusedImplicit) override val reader: (ReadWriteModule, DescriptorModule) ?=> Reader[Inner] = (mem, offset) => summon[ReadWriteModule].memReader(mem, offset).asVarArgs - @nowarn(TypeDescriptor.unusedImplicit) override val argumentTransition : (TransitionModule, ReadWriteModule, Allocator) ?=> ArgumentTransition[ Inner ] = _.mem.asAddress - @nowarn(TypeDescriptor.unusedImplicit) override val writer: (ReadWriteModule, DescriptorModule) ?=> Writer[Inner] = (mem, offset, value) => summon[ReadWriteModule].memWriter(mem, offset, value.mem) - @nowarn(TypeDescriptor.unusedImplicit) override val returnTransition : (TransitionModule, ReadWriteModule) ?=> ReturnTransition[Inner] = o => summon[TransitionModule].addressReturn(o).asVarArgs + +case class CUnionDescriptor(possibleTypes: Set[TypeDescriptor]) + extends TypeDescriptor: + type Inner = CUnion[? <: NonEmptyTuple] + + override val reader: (ReadWriteModule, DescriptorModule) ?=> Reader[Inner] = + ??? + + override val returnTransition + : (TransitionModule, ReadWriteModule) ?=> ReturnTransition[Inner] = ??? + + override val argumentTransition + : (TransitionModule, ReadWriteModule, Allocator) ?=> ArgumentTransition[ + Inner + ] = ??? + + override val writer: (ReadWriteModule, DescriptorModule) ?=> Writer[Inner] = + ??? diff --git a/core/src/fr/hammons/slinc/types/Arch.scala b/core/src/fr/hammons/slinc/types/Arch.scala index e817d941..a0d1b8f3 100644 --- a/core/src/fr/hammons/slinc/types/Arch.scala +++ b/core/src/fr/hammons/slinc/types/Arch.scala @@ -1,9 +1,5 @@ package fr.hammons.slinc.types -import scala.annotation.nowarn - -//todo: remove once https://github.com/lampepfl/dotty/issues/16878 is fixed -@nowarn("msg=unused explicit parameter") private[slinc] enum Arch: case I386 case X64 diff --git a/core/src/fr/hammons/slinc/types/OS.scala b/core/src/fr/hammons/slinc/types/OS.scala index 22f63d4b..7a397336 100644 --- a/core/src/fr/hammons/slinc/types/OS.scala +++ b/core/src/fr/hammons/slinc/types/OS.scala @@ -1,9 +1,5 @@ package fr.hammons.slinc.types -import scala.annotation.nowarn - -//todo: remove once https://github.com/lampepfl/dotty/issues/16878 is fixed -@nowarn("msg=unused explicit parameter") enum OS: case Linux case Darwin diff --git a/core/test/src/fr/hammons/slinc/TypeDescriptorSpec.scala b/core/test/src/fr/hammons/slinc/TypeDescriptorSpec.scala new file mode 100644 index 00000000..72717863 --- /dev/null +++ b/core/test/src/fr/hammons/slinc/TypeDescriptorSpec.scala @@ -0,0 +1,27 @@ +package fr.hammons.slinc +import types.* + +class TypeDescriptorSpec extends munit.FunSuite: + case class A(a: CInt, b: CInt) derives Struct + test("DescriptorOf[CUnion[(Int, Float, A)]] gives appropriate descriptor"): + assertEquals( + DescriptorOf[CUnion[(CInt, CFloat, A)]]: TypeDescriptor, + CUnionDescriptor( + Set(IntDescriptor, FloatDescriptor, summon[Struct[A]].descriptor) + ): TypeDescriptor + ) + + test( + "DescriptorOf[CUnion[(CUnion[(Int, Float)], CUnion[(Int, Float)], A,A])]] doesn't double descriptors" + ): + assertEquals( + DescriptorOf[ + CUnion[(CUnion[(Int, Float)], CUnion[(Int, Float)], A, A)] + ]: TypeDescriptor, + CUnionDescriptor( + Set( + CUnionDescriptor(Set(IntDescriptor, FloatDescriptor)), + summon[Struct[A]].descriptor + ) + ): TypeDescriptor + ) diff --git a/core/test/src/fr/hammons/slinc/modules/DescriptorSpec.scala b/core/test/src/fr/hammons/slinc/modules/DescriptorSpec.scala new file mode 100644 index 00000000..6b993839 --- /dev/null +++ b/core/test/src/fr/hammons/slinc/modules/DescriptorSpec.scala @@ -0,0 +1,25 @@ +package fr.hammons.slinc.modules + +import fr.hammons.slinc.Slinc +import fr.hammons.slinc.DescriptorOf +import fr.hammons.slinc.types.CLongLong +import fr.hammons.slinc.types.CInt +import fr.hammons.slinc.types.CFloat +import fr.hammons.slinc.CUnion +import fr.hammons.slinc.Struct + +trait DescriptorSpec(val slinc: Slinc) extends munit.FunSuite: + import slinc.dm + case class A(a: CInt, b: CInt, c: CInt, d: CLongLong, e: CLongLong) + derives Struct + test("CUnionDescriptor.size gives the right size"): + assertEquals( + DescriptorOf[CUnion[(CInt, A, CFloat)]].size, + DescriptorOf[A].size + ) + + test("CUnionDescriptor.alignment gives the right alignment"): + assertEquals( + DescriptorOf[CUnion[(CInt, A, CFloat)]].alignment, + DescriptorOf[A].alignment + ) diff --git a/j17/src/fr/hammons/slinc/Allocator17.scala b/j17/src/fr/hammons/slinc/Allocator17.scala index fcba4f1e..7e5ae3a6 100644 --- a/j17/src/fr/hammons/slinc/Allocator17.scala +++ b/j17/src/fr/hammons/slinc/Allocator17.scala @@ -6,13 +6,12 @@ import jdk.incubator.foreign.{ MemorySegment, ResourceScope, CLinker, - FunctionDescriptor as JFunctionDescriptor + FunctionDescriptor as JFunctionDescriptor, + GroupLayout }, CLinker.{C_POINTER, C_INT, C_LONG_LONG, C_DOUBLE, VaList} import fr.hammons.slinc.modules.{descriptorModule17, transitionModule17} import fr.hammons.slinc.modules.LinkageModule17 -import scala.annotation.nowarn -@nowarn("msg=unused import") class Allocator17( segmentAllocator: SegmentAllocator, scope: ResourceScope, @@ -60,6 +59,20 @@ class Allocator17( .asInstanceOf[Addressable] ) ) + case (cd: CUnionDescriptor, v: CUnion[?]) => + builder.vargFromSegment( + descriptorModule17.toMemoryLayout(cd) match + case gl: GroupLayout => gl + case _ => throw Error("got a non group layout from CUnionDescriptor") + , + v.mem.asBase match + case ms: MemorySegment => ms + case _ => throw Error("base of mem was not J17 MemorySegment!!") + ) + case (a, d) => + throw Error( + s"Unsupported type descriptor/data pairing for VarArgs: $a - $d" + ) override def makeVarArgs(vbuilder: VarArgsBuilder): VarArgs = VarArgs17( diff --git a/j17/src/fr/hammons/slinc/VarArgs17.scala b/j17/src/fr/hammons/slinc/VarArgs17.scala index 6153fe5a..f34182c5 100644 --- a/j17/src/fr/hammons/slinc/VarArgs17.scala +++ b/j17/src/fr/hammons/slinc/VarArgs17.scala @@ -30,8 +30,9 @@ class VarArgs17(args: VaList) extends VarArgs: ) .nn ) - case AliasDescriptor(real) => get(real) - case VaListDescriptor => args.vargAsAddress(C_POINTER).nn + case AliasDescriptor(real) => get(real) + case VaListDescriptor => args.vargAsAddress(C_POINTER).nn + case CUnionDescriptor(possibleTypes) => get(possibleTypes.maxBy(_.size)) def get[A](using d: DescriptorOf[A]): A = transitionModule17.methodReturn[A](d.descriptor, get(d.descriptor)) @@ -46,8 +47,9 @@ class VarArgs17(args: VaList) extends VarArgs: case PtrDescriptor => args.skip(C_POINTER) case sd: StructDescriptor => args.skip(descriptorModule17.toGroupLayout(sd)) - case AliasDescriptor(real) => skip(real) - case VaListDescriptor => args.skip(C_POINTER) + case AliasDescriptor(real) => skip(real) + case VaListDescriptor => args.skip(C_POINTER) + case CUnionDescriptor(possibleTypes) => skip(possibleTypes.maxBy(_.size)) def skip[A](using dO: DescriptorOf[A]): Unit = skip(dO.descriptor) diff --git a/j17/src/fr/hammons/slinc/modules/DescriptorModule17.scala b/j17/src/fr/hammons/slinc/modules/DescriptorModule17.scala index edd1ba48..0e3f0fef 100644 --- a/j17/src/fr/hammons/slinc/modules/DescriptorModule17.scala +++ b/j17/src/fr/hammons/slinc/modules/DescriptorModule17.scala @@ -9,8 +9,7 @@ import jdk.incubator.foreign.CLinker.{ C_DOUBLE, C_FLOAT, C_LONG_LONG, - C_POINTER, - C_VA_LIST + C_POINTER } import jdk.incubator.foreign.{ MemoryLayout, @@ -18,7 +17,7 @@ import jdk.incubator.foreign.{ MemorySegment, GroupLayout, CLinker -}, CLinker.VaList +} import scala.collection.concurrent.TrieMap given descriptorModule17: DescriptorModule with @@ -36,6 +35,7 @@ given descriptorModule17: DescriptorModule with case _: StructDescriptor => classOf[MemorySegment] case VaListDescriptor => classOf[MemoryAddress] case ad: AliasDescriptor[?] => toCarrierType(ad.real) + case ud: CUnionDescriptor => classOf[MemorySegment] def genLayoutList( layouts: Seq[MemoryLayout], @@ -80,11 +80,14 @@ given descriptorModule17: DescriptorModule with case sd: StructDescriptor => Bytes(toGroupLayout(sd).byteSize()) case VaListDescriptor => Bytes(toMemoryLayout(VaListDescriptor).byteSize()) - case ad: AliasDescriptor[?] => sizeOf(ad.real) + case ad: AliasDescriptor[?] => sizeOf(ad.real) + case CUnionDescriptor(possibleTypes) => possibleTypes.map(sizeOf).max override def alignmentOf(td: TypeDescriptor): Bytes = td match case s: StructDescriptor => s.members.view.map(_.descriptor).map(alignmentOf).max + case CUnionDescriptor(possibleTypes) => + possibleTypes.view.map(alignmentOf).max case _ => sizeOf(td) override def memberOffsets(sd: List[TypeDescriptor]): IArray[Bytes] = @@ -125,6 +128,8 @@ given descriptorModule17: DescriptorModule with case VaListDescriptor => C_POINTER.nn case sd: StructDescriptor => toGroupLayout(sd) case ad: AliasDescriptor[?] => toMemoryLayout(ad.real) + case CUnionDescriptor(possibleTypes) => + MemoryLayout.unionLayout(possibleTypes.map(toMemoryLayout).toSeq*).nn def toMemoryLayout(smd: StructMemberDescriptor): MemoryLayout = toMemoryLayout(smd.descriptor).withName(smd.name).nn diff --git a/j17/test/src/fr/hammons/slinc/modules/Descriptor17Spec.scala b/j17/test/src/fr/hammons/slinc/modules/Descriptor17Spec.scala new file mode 100644 index 00000000..61d36566 --- /dev/null +++ b/j17/test/src/fr/hammons/slinc/modules/Descriptor17Spec.scala @@ -0,0 +1,5 @@ +package fr.hammons.slinc.modules + +import fr.hammons.slinc.Slinc17 + +class Descriptor17Spec extends DescriptorSpec(Slinc17.default) diff --git a/j19/src/fr/hammons/slinc/Allocator19.scala b/j19/src/fr/hammons/slinc/Allocator19.scala index 2edf3484..1a2e5b21 100644 --- a/j19/src/fr/hammons/slinc/Allocator19.scala +++ b/j19/src/fr/hammons/slinc/Allocator19.scala @@ -10,6 +10,7 @@ import java.lang.foreign.ValueLayout import scala.jdk.FunctionConverters.* import java.lang.foreign.Addressable import java.lang.foreign.MemorySegment +import java.lang.foreign.GroupLayout import fr.hammons.slinc.modules.LinkageModule19 class Allocator19( @@ -95,6 +96,19 @@ class Allocator19( .asInstanceOf[Addressable] ) ) + case (cUnionDescriptor: CUnionDescriptor, c: CUnion[?]) => + builder.addVarg( + descriptorModule19.toMemoryLayout(cUnionDescriptor) match + case g: GroupLayout => g + case _ => + throw Error("CUnionDescriptor didn't resolve to group layout??") + , + c.mem.asBase match + case ms: MemorySegment => ms + case _ => throw Error("Illegal datatype") + ) + case (td, d) => + throw Error(s"Unsupported datatype for $td - $d") override def makeVarArgs(vbuilder: VarArgsBuilder): VarArgs = import scala.compiletime.asMatchable diff --git a/j19/src/fr/hammons/slinc/VarArgs19.scala b/j19/src/fr/hammons/slinc/VarArgs19.scala index 4f6fdf4c..a161a498 100644 --- a/j19/src/fr/hammons/slinc/VarArgs19.scala +++ b/j19/src/fr/hammons/slinc/VarArgs19.scala @@ -28,6 +28,8 @@ private class VarArgs19(vaList: VaList) extends VarArgs: case PtrDescriptor | VaListDescriptor => vaList.skip(ValueLayout.ADDRESS) case sd: StructDescriptor => vaList.skip(descriptorModule19.toGroupLayout(sd)) + case cd: CUnionDescriptor => + vaList.skip(descriptorModule19.toMemoryLayout(cd)) case AliasDescriptor(real) => skip(real) override def skip[A](using dO: DescriptorOf[A]): Unit = skip(dO.descriptor) @@ -61,6 +63,8 @@ private class VarArgs19(vaList: VaList) extends VarArgs: ) case AliasDescriptor(real) => as(real) case VaListDescriptor => vaList.nextVarg(ValueLayout.ADDRESS).nn + case CUnionDescriptor(possibleTypes) => + as(possibleTypes.maxBy(_.size)) override def get[A](using d: DescriptorOf[A]): A = transitionModule19.methodReturn[A](d.descriptor, as(d.descriptor)) diff --git a/j19/src/fr/hammons/slinc/modules/DescriptorModule19.scala b/j19/src/fr/hammons/slinc/modules/DescriptorModule19.scala index db022315..ecad5a44 100644 --- a/j19/src/fr/hammons/slinc/modules/DescriptorModule19.scala +++ b/j19/src/fr/hammons/slinc/modules/DescriptorModule19.scala @@ -7,7 +7,6 @@ import java.lang.foreign.MemoryLayout import java.lang.foreign.MemoryAddress import java.lang.foreign.MemorySegment import java.lang.foreign.GroupLayout -import java.lang.foreign.VaList given descriptorModule19: DescriptorModule with private val sdt = TrieMap.empty[StructDescriptor, GroupLayout] @@ -24,6 +23,8 @@ given descriptorModule19: DescriptorModule with case VaListDescriptor => ValueLayout.ADDRESS.nn case sd: StructDescriptor => toGroupLayout(sd) case ad: AliasDescriptor[?] => toMemoryLayout(ad.real) + case CUnionDescriptor(possibleTypes) => + MemoryLayout.unionLayout(possibleTypes.view.map(toMemoryLayout).toSeq*).nn def toMemoryLayout(smd: StructMemberDescriptor): MemoryLayout = toMemoryLayout(smd.descriptor).withName(smd.name).nn @@ -85,6 +86,7 @@ given descriptorModule19: DescriptorModule with case PtrDescriptor => classOf[MemoryAddress] case _: StructDescriptor => classOf[MemorySegment] case ad: AliasDescriptor[?] => toCarrierType(ad.real) + case CUnionDescriptor(_) => classOf[MemorySegment] override def memberOffsets(sd: List[TypeDescriptor]): IArray[Bytes] = offsets.getOrElseUpdate( @@ -124,6 +126,7 @@ given descriptorModule19: DescriptorModule with case VaListDescriptor => Bytes(ValueLayout.ADDRESS.nn.byteSize()) case sd: StructDescriptor => Bytes(toGroupLayout(sd).byteSize()) case ad: AliasDescriptor[?] => sizeOf(ad.real) + case CUnionDescriptor(possibleTypes) => possibleTypes.view.map(sizeOf).max override def alignmentOf(td: TypeDescriptor): Bytes = import java.lang.foreign.ValueLayout @@ -140,3 +143,5 @@ given descriptorModule19: DescriptorModule with sd.members.view.map(_.descriptor).map(alignmentOf).max case ad: AliasDescriptor[?] => alignmentOf(ad.real) + case CUnionDescriptor(possibleTypes) => + possibleTypes.view.map(alignmentOf).max diff --git a/j19/test/src/fr/hammons/slinc/modules/Descriptor19Spec.scala b/j19/test/src/fr/hammons/slinc/modules/Descriptor19Spec.scala new file mode 100644 index 00000000..473d056b --- /dev/null +++ b/j19/test/src/fr/hammons/slinc/modules/Descriptor19Spec.scala @@ -0,0 +1,5 @@ +package fr.hammons.slinc.modules + +import fr.hammons.slinc.Slinc19 + +class Descriptor19Spec extends DescriptorSpec(Slinc19.default)