Elm Exactly
Results / elm /

StandardA91BasicsAliasTest

Tags:elm19-bugelm-spec

Checks, in A Standard Definition of Elm?:restriction modules-basics-qualifier

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
Only an import of the module Basics may provide the qualifier `Basics`.

A Standard Definition of Elm?, ruling A91: an import `import M as Basics` requires `M` to be
`Basics`, so that `Basics.True`, `Basics.False` and `Basics.negate`, which derived forms introduce,
always denote the initial basis. <https://elm-test-suite.netlify.app/standard/restrictions/modules-basics-qualifier>

Elm 0.19.1 accepts `import Dict as Basics`.

Results

elm-0.19.1

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

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

elm-0.19.2

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

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

elm-0.19.3

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

    StandardA91BasicsAliasTest ───> /home/runner/work/elm-test-suite/elm-test-suite/.work/elm-0.19.3/elm/out/StandardA91BasicsAliasTest.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/StandardA91BasicsAliasTest] in its title.

Source

The -- CHECK: lines give the expected output.

module StandardA91BasicsAliasTest exposing (..)
{-| Only an import of the module Basics may provide the qualifier `Basics`.
A Standard Definition of Elm?, ruling A91: an import `import M as Basics` requires `M` to be
`Basics`, so that `Basics.True`, `Basics.False` and `Basics.negate`, which derived forms introduce,
always denote the initial basis. <https://elm-test-suite.netlify.app/standard/restrictions/modules-basics-qualifier>
Elm 0.19.1 accepts `import Dict as Basics`.
-}
-- TAGS: elm19-bug
-- TAGS: elm-spec, modules-basics-qualifier
-- COMPILE-ERROR: import Dict as Basics
-- CHECK: {{-- [A-Z ]+ -}}
import Dict as Basics
import Html
main =
Html.text (if 1 < 2 then "yes" else "no")

Lean translation

No reduced program for Lean's evaluator: the test expects a compile error, so it has no meaning to evaluate. Lean has the program as written, in source syntax, and proves what the static semantics says of it (below). See the Lean mechanisation for which tests are in Lean, and why.

Static semantics: Lean proves that the program as written is not legal, so a compiler must reject it (refuse_elm_StandardA91BasicsAliasTest, in StandardElmMech/Certs/). The program breaks a syntactic restriction, which the kernel checks on its syntax tree; no type inference is involved (Stat.not_legal_of_syn): res:modules-basics-qualifier, res:program-import-order. It holds for every derivation, with no hypothesis about principality.