Elm Exactly
Results / elm /

StandardA8SurrogateEscapeTest

Tags:elm19-bugelm-spec

Checks, in A Standard Definition of Elm?:restriction core-escape-unicodefigure core-escapes

Not translated into Lean for the mechanisation of the book: see why.

elm-0.19.1 failelm-0.19.2 failelm-0.19.3 faillamdera-1.5.0 fail
`\u{D800}` is not an escape sequence: a surrogate code point is not a character.

A Standard Definition of Elm?, ruling A8: the escape `\u{h}` denotes a Unicode scalar value, so
the surrogate code points D800 to DFFF are not allowed. <https://elm-test-suite.netlify.app/standard/restrictions/core-escape-unicode>

Elm 0.19.1 accepts `"\u{D800}"` and makes a string holding a lone surrogate. `elm`'s
`CharLiteralSurrogateEscapeTest` checks the same for a Char literal. Three tests tagged
`elm19-bug` use surrogate escapes because their issues do (`CompilerIssue2366LoneSurrogateCharLiteralTest`,
`CoreIssue1060StringToListLoneSurrogateTest`, `UrlIssue54PercentEncodeLoneSurrogateTest`); each
says so, and names a test that follows A8.

Results

elm-0.19.1

fail
compiled, but a compile error was expected
--- compiler output ---
Success! Compiled 1 module.

    StandardA8SurrogateEscapeTest ───> /home/runner/work/elm-test-suite/elm-test-suite/.work/elm-0.19.1/elm/out/StandardA8SurrogateEscapeTest.js

elm-0.19.2

fail
compiled, but a compile error was expected
--- compiler output ---
Success! Compiled 1 module.

    StandardA8SurrogateEscapeTest ───> /home/runner/work/elm-test-suite/elm-test-suite/.work/elm-0.19.2/elm/out/StandardA8SurrogateEscapeTest.js

elm-0.19.3

fail
compiled, but a compile error was expected
--- compiler output ---
Success! Compiled 1 module.

    StandardA8SurrogateEscapeTest ───> /home/runner/work/elm-test-suite/elm-test-suite/.work/elm-0.19.3/elm/out/StandardA8SurrogateEscapeTest.js

lamdera-1.5.0

fail
compiled, but a compile error was expected
--- compiler output ---
Success! Compiled 1 module.

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm/StandardA8SurrogateEscapeTest] in its title.

Source

The -- CHECK: lines give the expected output.

module StandardA8SurrogateEscapeTest exposing (..)
{-| `\u{D800}` is not an escape sequence: a surrogate code point is not a character.
A Standard Definition of Elm?, ruling A8: the escape `\u{h}` denotes a Unicode scalar value, so
the surrogate code points D800 to DFFF are not allowed. <https://elm-test-suite.netlify.app/standard/restrictions/core-escape-unicode>
Elm 0.19.1 accepts `"\u{D800}"` and makes a string holding a lone surrogate. `elm`'s
`CharLiteralSurrogateEscapeTest` checks the same for a Char literal. Three tests tagged
`elm19-bug` use surrogate escapes because their issues do (`CompilerIssue2366LoneSurrogateCharLiteralTest`,
`CoreIssue1060StringToListLoneSurrogateTest`, `UrlIssue54PercentEncodeLoneSurrogateTest`); each
says so, and names a test that follows A8.
-}
-- TAGS: elm19-bug
-- TAGS: elm-spec, core-escape-unicode, fig:core-escapes
-- COMPILE-ERROR: a surrogate escape
-- CHECK: {{-- [A-Z ]+ -}}
import Html
loneSurrogate : String
loneSurrogate =
"\u{D800}"
main =
Html.text loneSurrogate

Lean translation

No reduced program for Lean's evaluator: the test expects a compile error, so it has no meaning to evaluate. Static semantics: expected to be rejected, and the translator's front end refuses it: it breaks a restriction on characters, tokens and layout, which Lean does not model. See the Lean mechanisation for which tests are in Lean, and why.