Skip to content

Document identifier index limit #44

Description

@travisbrown

The Haskell implementation will happily parse an arbitrarily large index on an identifier (although it looks like something's overflowing either in the representation or the encoding):

$ dhall encode --json <<< "x @ 9223372036854775808"
[
    "x",
    -9223372036854775808
]

We stop at Long.MaxValue:

scala> import org.dhallj.parser.DhallParser
import org.dhallj.parser.DhallParser

scala> DhallParser.parse("x @ 9223372036854775807")
res0: org.dhallj.core.Expr.Parsed = x@9223372036854775807

scala> DhallParser.parse("x @ 9223372036854775808")
java.lang.NumberFormatException: For input string: "9223372036854775808"
  at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)
  at java.base/java.lang.Long.parseLong(Long.java:703)
  ...

I think this is fine, since nobody's ever going to bind 9,223,372,036,854,775,808 xs, so this will never type-check, anyway, but we should document the difference and maybe wrap the NumberFormatException in an ParseException.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions