#426 aqua does not generate correct getDataSrv (#429)

This commit is contained in:
Dima 2022-02-09 13:24:21 +03:00 committed by GitHub
parent 88da133e00
commit 5a79dbb76a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -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
}

View File

@ -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)
}
}