~ehmry/dhall-nim

73cdb3313ee657af143f326314a617eeef92fd67 — Emery Hemingway 1 year, 1 month ago 35f2b59
binary: reject lambdas with explicit "_" labels
1 files changed, 7 insertions(+), 2 deletions(-)

M src/dhall/binary.nim
M src/dhall/binary.nim => src/dhall/binary.nim +7 -2
@@ 284,16 284,21 @@ proc nextTerm(parser: var CborParser): Term =
        of 4:
          result = Term(kind: kind, lambdaLabel: parser.nextText(),
              lambdaType: parser.nextTerm(), lambdaBody: parser.nextTerm())
          parseAssert(result.lambdaLabel != "_")
        else:
          parseAssert(false)

      of tPi:
        if arrayLen == 3:
        case arrayLen:
        of 3:
          result = Term(kind: kind, piLabel: "_", piType: parser.nextTerm(),
              piBody: parser.nextTerm())
        else:
        of 4:
          result = Term(kind: kind, piLabel: parser.nextText(),
              piType: parser.nextTerm(), piBody: parser.nextTerm())
          parseAssert(result.piLabel != "_")
        else:
          parseAssert(false)

      of tOp:
        parseAssert(arrayLen == 4)