mirror of
https://github.com/fluencelabs/aqua.git
synced 2025-04-24 22:42:13 +00:00
parent
88da133e00
commit
5a79dbb76a
@ -46,6 +46,7 @@ sealed trait ProductType extends Type {
|
||||
|
||||
lazy val labelledData: List[(String, DataType)] = this match {
|
||||
case LabelledConsType(label, t: DataType, pt) => (label -> t) :: pt.labelledData
|
||||
case LabelledConsType(label, t: ArrowType, pt) => pt.labelledData
|
||||
case UnlabelledConsType(_, pt) => pt.labelledData
|
||||
case _ => Nil
|
||||
}
|
||||
|
@ -154,4 +154,17 @@ class TypeSpec extends AnyFlatSpec with Matchers {
|
||||
accepts(four, one) should be(false)
|
||||
}
|
||||
|
||||
"labeled types" should "create correc labels" in {
|
||||
val cons = LabelledConsType(
|
||||
"arg1",
|
||||
ArrowType(
|
||||
UnlabelledConsType(string, NilType),
|
||||
UnlabelledConsType(string, NilType)
|
||||
),
|
||||
LabelledConsType("arg2", string, NilType)
|
||||
)
|
||||
|
||||
cons.labelledData should be(("arg2", string) :: Nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user