Elm Exactly
Results / elm-core /

StringToListLoneSurrogateTest

elm-0.19.1 failelm-0.19.2 failelm-0.19.3 faillamdera-1.5.0 fail

Issue: elm/core#1060

`String.toList` of a string holding a lone low surrogate returns one `Char`.

The bug of <https://github.com/elm/core/issues/1060>, with a program that follows A Standard Definition of Elm? The issue, and `CoreIssue1060StringToListLoneSurrogateTest` (tagged `elm19-bug`), write the
lone surrogate as the escape `"\u{dd56}"`, which ruling A8 makes invalid: an escape must denote a
Unicode scalar value. <https://elm-test-suite.netlify.app/standard/restrictions/core-escape-unicode>

Here the lone surrogate is computed, `String.fromChar (Char.fromCode 0xDD56)`, so the program is
valid under A8, and the string is the same. Elm 0.19.1 still loops forever on `String.toList` of it
until it runs out of memory; the test caps the JavaScript heap so that this fails quickly.

Results

elm-0.19.1

failran in 3392 ms
killed by SIGABRT
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.

<--- Last few GCs --->

[28373:0xde7b000]     3289 ms: Mark-Compact (reduce) 255.0 (263.1) -> 254.6 (261.1) MB, pooled: 0 MB, 121.54 / 0.00 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 124 ms) (average mu = 0.163, current 

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xe48c12 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 2: 0x1249780 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 3: 0x1249a57 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 4: 0x1478965  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 5: 0x1478993  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 6: 0x1491a6a  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 7: 0x1494c38  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 8: 0x1cfd6e1  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]

elm-0.19.2

failran in 3530 ms
killed by SIGABRT
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.

<--- Last few GCs --->

[57674:0x3cf9d000]     3406 ms: Mark-Compact (reduce) 253.5 (261.9) -> 253.1 (259.6) MB, pooled: 0 MB, 126.48 / 0.00 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 130 ms) (average mu = 0.187, current

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xe48c12 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 2: 0x1249780 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 3: 0x1249a57 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 4: 0x1478965  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 5: 0x1478993  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 6: 0x1491a6a  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 7: 0x1494c38  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 8: 0x1cfd6e1  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]

elm-0.19.3

failran in 3338 ms
killed by SIGABRT
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.

<--- Last few GCs --->

[87117:0x392ad000]     3225 ms: Mark-Compact (reduce) 253.3 (261.6) -> 252.8 (259.4) MB, pooled: 0 MB, 122.27 / 0.00 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 125 ms) (average mu = 0.162, current

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xe48c12 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 2: 0x1249780 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 3: 0x1249a57 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 4: 0x1478965  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 5: 0x1478993  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 6: 0x1491a6a  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 7: 0x1494c38  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 8: 0x1cfd6e1  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]

lamdera-1.5.0

failran in 3233 ms
killed by SIGABRT
--- output ---

<--- Last few GCs --->

[115987:0x75f9000]     3136 ms: Mark-Compact (reduce) 254.7 (263.1) -> 254.4 (260.9) MB, pooled: 0 MB, 123.78 / 0.00 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 126 ms) (average mu = 0.159, current

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xe48c12 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 2: 0x1249780 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 3: 0x1249a57 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 4: 0x1478965  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 5: 0x1478993  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 6: 0x1491a6a  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 7: 0x1494c38  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 8: 0x1cfd6e1  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module StringToListLoneSurrogateTest exposing (main)
{-| `String.toList` of a string holding a lone low surrogate returns one `Char`.
The bug of <https://github.com/elm/core/issues/1060>, with a program that follows A Standard Definition of Elm? The issue, and `CoreIssue1060StringToListLoneSurrogateTest` (tagged `elm19-bug`), write the
lone surrogate as the escape `"\u{dd56}"`, which ruling A8 makes invalid: an escape must denote a
Unicode scalar value. <https://elm-test-suite.netlify.app/standard/restrictions/core-escape-unicode>
Here the lone surrogate is computed, `String.fromChar (Char.fromCode 0xDD56)`, so the program is
valid under A8, and the string is the same. Elm 0.19.1 still loops forever on `String.toList` of it
until it runs out of memory; the test caps the JavaScript heap so that this fails quickly.
-}
-- CHECK: length: 1
-- ENV: NODE_OPTIONS=--max-old-space-size=256
import Html exposing (text)
main =
let
loneLowSurrogate =
String.fromChar (Char.fromCode 0xDD56)
_ =
Debug.log "length" (List.length (String.toList loneLowSurrogate))
in
text "done"