Skip to content

Commit

Permalink
fix Signature
Browse files Browse the repository at this point in the history
  • Loading branch information
gciatto committed Sep 14, 2020
1 parent abe986a commit 76e88d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ data class Signature(
)
}
args.last().let {
it is Struct && functor == varargStructFunctor && arity == 2 &&
args.first().isInt &&
args.last() == varargAtom
it is Struct && it.functor == varargStructFunctor && it.arity == 2 &&
it.args.first().isInt &&
it.args.last() == varargAtom
} -> {
Signature(
args.first().`as`<Atom>().value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ internal class SignatureTest {

@Test
fun fromTermWithStructCreatesCorrectInstance() {
signatures.forEach { assertEquals(it, Signature.fromSignatureTerm(it.toTerm()) ?: fail()) }
signatures.forEach {
val reconstructed = Signature.fromSignatureTerm(it.toTerm())
?: fail("Cannot reconstruct signature $it from it.toTerm(): ${it.toTerm()}")
assertEquals(it, reconstructed)
}

signatureTerms.zip(signatures).forEach { (signatureTerm, signature) ->
assertEquals(signature, Signature.fromSignatureTerm(signatureTerm) ?: fail())
Expand Down

0 comments on commit 76e88d2

Please sign in to comment.