# Snapshot report for `src/validation/__tests__/validation-spec.js`

The actual snapshot is saved in `validation-spec.js.snap`.

Generated by [AVA](https://ava.li).

## ast must have metadata attached

> Snapshot 1

    Error {
      message: 'Missing AST metadata!',
    }

## const cannot be re-asigned

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 2 problems.␊
      ␊
      ␊
            x = 1;␊
            ^^ const variables cannot be reassigned, use let instead.␊
      Cannot reassign a const variable x␊
        at test() (spec.walt:4:6)␊
      ␊
      ␊
            y += 1;␊
            ^^ const variables cannot be reassigned, use let instead.␊
      Cannot reassign a const variable y␊
        at test() (spec.walt:6:6)␊
      `,
    }

## constants must be initialized

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 2 problems.␊
      ␊
      ␊
          const g: i32 = 2 + 2;␊
          ^^^^^^^^^^^^^^^^^^^^ WebAssembly does not allow for non number literal constant initializers.␊
      Global Constants must be initialized with a Number literal.␊
        at global (spec.walt:2:4)␊
      ␊
      ␊
            const x: i32;␊
            ^^^^^^^^^^^^ Local Constants must be initialized with an expression.␊
      Constant declaration without an initializer.␊
        at test() (spec.walt:4:6)␊
      `,
    }

## functions must be defined

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 4 problems.␊
      ␊
      ␊
            const ptr: Type = 0;␊
            ^^^^^^^^^^^^^^^^^^^ Variables must be assigned with a known type.␊
      Unknown type used in a declartion, "Type"␊
        at test() (spec.walt:3:6)␊
      ␊
      ␊
            ptr();␊
            ^^^^ ptr has type Type which is not defined. Inidrect calls must have pre-defined types.␊
      Cannot make an indirect call without a valid function type␊
        at test() (spec.walt:4:6)␊
      ␊
      ␊
            return notDefined();␊
                   ^^^^^^^^^^^ notDefined is not defined.␊
      Undefined function reference␊
        at test() (spec.walt:5:13)␊
      ␊
      ␊
            return notDefined();␊
            ^^^^^^^^^^^^^^^^^^ Inconsistent return value. Expected i32 received null␊
      Missing return value␊
        at test() (spec.walt:5:6)␊
      `,
    }

## functions must have consistent returns

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 2 problems.␊
      ␊
      ␊
            return;␊
            ^^^^^^ Inconsistent return value. Expected i32 received null␊
      Missing return value␊
        at i32void() (spec.walt:3:6)␊
      ␊
      ␊
            return x;␊
            ^^^^^^^^ Inconsistent return value. Expected i32 received i64␊
      Missing return value␊
        at i32i64() (spec.walt:7:6)␊
      `,
    }

## global exports must have value

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 2 problems.␊
      ␊
      ␊
      export const x: i32;␊
             ^^^^^^^^^^^^ ␊
      Global exports must have a value␊
        at global (spec.walt:1:7)␊
      ␊
      ␊
      export const x: i32;␊
             ^^^^^^^^^^^^ Global constants must be initialized with a Number literal.␊
      Constant declaration without an initializer.␊
        at global (spec.walt:1:7)␊
      `,
    }

## typos throw

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 1 problems.␊
      ␊
      ␊
      expost const x: i32;␊
                   ^ ␊
      Unexpected expression Pair␊
        at global (spec.walt:1:13)␊
      `,
    }

## undefined object properties

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 2 problems.␊
      ␊
      ␊
            obj = { y: 5 };␊
            ^^^^ Undefined key y for type T␊
      Cannot generate memory offset␊
        at test() (spec.walt:5:6)␊
      ␊
      ␊
            obj.y = 5;␊
            ^^^ Undefined key y for type T␊
      Cannot generate memory offset␊
        at test() (spec.walt:6:6)␊
      `,
    }

## undefined types throw

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 1 problems.␊
      ␊
      ␊
      import { foo: Type } from 'env';␊
                    ^^^^^ Invalid Import. Type type does not exist␊
      Undefined Type Type␊
        at global (spec.walt:1:14)␊
      `,
    }

## unknown user types at global scope, error

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 2 problems.␊
      ␊
      ␊
          let t: unknown = 0;␊
          ^^^^^^^^^^^^^^^^^^ Variables must be assigned with a known type.␊
      Unknown type used in a declartion, "unknown"␊
        at global (spec.walt:2:4)␊
      ␊
      ␊
            let k: unknown = 0;␊
            ^^^^^^^^^^^^^^^^^^ Variables must be assigned with a known type.␊
      Unknown type used in a declartion, "unknown"␊
        at foo() (spec.walt:4:6)␊
      `,
    }

## unterminated assignment statements

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 1 problems.␊
      ␊
      ␊
            y = 3 + 3;␊
            ^^ Statments cannot be used in assignment expressions. Did you miss a semicolon?␊
      Unexpected statement in assignment␊
        at test() (spec.walt:6:6)␊
      `,
    }

## unterminated declaration statements

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 1 problems.␊
      ␊
      ␊
            const x: i32 = 0␊
            x = 2;␊
            ^ Attempting to assign a statement to a variable. Did you miss a semicolon(;)?␊
      Unexpected statement Assignment␊
        at test() (spec.walt:3:6)␊
      `,
    }

## untyped imports need to be compiled out via a linker/build step

> Snapshot 1

    Error {
      message: `Cannot generate WebAssembly for spec.walt. 1 problems.␊
      ␊
      ␊
            foo␊
          } from './foo';␊
            ^ Looks like you'd like to infer a type, but it was never provided by a linker. Non-concrete types cannot be compiled.␊
      Infered type not supplied.␊
        at global (spec.walt:3:6)␊
      `,
    }
