Elm Exactly
Results / elm /

TypeMismatchShaderUnderIntTest

Tags:elm19-compile-errorelm-unspecced

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
A GLSL shader literal annotated as `Int` is rejected with a TYPE MISMATCH.

`x : Int` is defined as `[glsl| void main () {} |]`, whose type is a `Shader`, not an `Int`.

A Standard Definition of Elm? leaves out embedded shader blocks, which belong to a graphics
extension rather than to the language (its preface): `[glsl| ... |]` is not a phrase of Standard
Elm, so the book says nothing of its type.

Results

elm-0.19.1

pass
Output
Compiling ...-- TYPE MISMATCH ------------------------ src/TypeMismatchShaderUnderIntTest.elm

Something is off with the body of the `x` definition:

18| x = [glsl| void main () {} |]
        ^^^^^^^^^^^^^^^^^^^^^^^^^
The body is a GLSL shader of type:

    WebGL.Shader a b {}

But the type annotation on `x` says it should be:

    Int

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling ...-- TYPE MISMATCH ------------------------ src/TypeMismatchShaderUnderIntTest.elm

Something is off with the body of the `x` definition:

18| x = [glsl| void main () {} |]
        ^^^^^^^^^^^^^^^^^^^^^^^^^
The body is a GLSL shader of type:

    WebGL.Shader a b {}

But the type annotation on `x` says it should be:

    Int

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- TYPE MISMATCH ------------------------ src/TypeMismatchShaderUnderIntTest.elm

Something is off with the body of the `x` definition:

18| x = [glsl| void main () {} |]
        ^^^^^^^^^^^^^^^^^^^^^^^^^
The body is a GLSL shader of type:

    WebGL.Shader a b {}

But the type annotation on `x` says it should be:

    Int

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- TYPE MISMATCH ------------------------ src/TypeMismatchShaderUnderIntTest.elm

Something is off with the body of the `x` definition:

18| x = [glsl| void main () {} |]
        ^^^^^^^^^^^^^^^^^^^^^^^^^
The body is a GLSL shader of type:

    WebGL.Shader a b {}

But the type annotation on `x` says it should be:

    Int

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module TypeMismatchShaderUnderIntTest exposing (..)
{-| A GLSL shader literal annotated as `Int` is rejected with a TYPE MISMATCH.
`x : Int` is defined as `[glsl| void main () {} |]`, whose type is a `Shader`, not an `Int`.
A Standard Definition of Elm? leaves out embedded shader blocks, which belong to a graphics
extension rather than to the language (its preface): `[glsl| ... |]` is not a phrase of Standard
Elm, so the book says nothing of its type.
-}
-- TAGS: elm19-compile-error, elm-unspecced
-- COMPILE-ERROR: TYPE MISMATCH, shader under Int
-- CHECK: -- TYPE MISMATCH -
x : Int
x = [glsl| void main () {} |]