Fehlercodes

Jeder Fehler, den der Hilde-Compiler meldet, trägt einen Code wie H4012. Der Code bezeichnet eine Stelle im Compiler; er bleibt gleich, wenn sich der Wortlaut einer Meldung ändert, und wird nie an eine andere Meldung vergeben. Die erste Ziffer nennt die Art: 0 Syntax, 1 Kommandozeile und Pakete, 2 Deklarationen, 3 Typen, 4 Linearität, 5 Einstiegspunkt, 6 allgemein, 7 Vorlagen, 8 SQL, 9 intern. H9999 steht für jeden internen Fehler: einen Fehler im Compiler, nicht im Programm.

Diese Seite wird aus der Quelle des Compilers erzeugt: die Liste der Codes aus den Stellen, die sie auslösen, und zu jedem Code Bedeutung, Meldung und ein Modul, das damit scheitert, aus dem Katalog des Compilers. Jeder Code hat eine eigene Adresse, zum Beispiel /de/errors/#H4012.

Die Quelle dieses Stands löst 570 Codes aus; für 570 davon hat der Katalog einen Eintrag.

In den Beispielen ist rot geschrieben, wo der Fehler liegt.

Abschnitte

1. Syntax

H0001

Im Quelltext steht ein Zeichen, mit dem kein Token beginnt. Außerhalb von Kommentaren und Strings sind nur Buchstaben, Ziffern, Leerraum und die Symbole der Sprache erlaubt.

Meldung:

Error:
  Title: Parse Error
  Error code: H0001
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 30
    To: line 3, column 31
  Description:
    Character not allowed in source text: `$`
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         let total: Int32 := 1 $ 2;
    4 |         printLn(total);
    5 |         return ExitSuccess();

Dieses Modul scheitert mit H0001:

module body Example is
    function main(): ExitCode is
        let total: Int32 := 1 $ 2;
        printLn(total);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H0003

Ein String-Literal wird mit einem Anführungszeichen geöffnet und nie geschlossen. Der Rest der Datei gehört dann zum String, und die Datei endet mitten darin.

Meldung:

Error:
  Title: Parse Error
  Error code: H0003
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 16
    To: line 6, column 16
  Description:
    End of file in string literal.
  Code:
    4 |         return ExitSuccess();
    5 |     end;
    6 | end module body.

Dieses Modul scheitert mit H0003:

module body Example is
    function main(): ExitCode is
        printLn("unclosed);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H0004

Ein String in dreifachen Anführungszeichen wird geöffnet und nie geschlossen, und die Datei endet mitten darin.

Meldung:

Error:
  Title: Parse Error
  Error code: H0004
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 16
    To: line 6, column 16
  Description:
    End of file in triple string literal.
  Code:
    4 |         return ExitSuccess();
    5 |     end;
    6 | end module body.

Dieses Modul scheitert mit H0004:

module body Example is
    function main(): ExitCode is
        printLn("""unclosed);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H0005

Die Tokens ergeben kein Programm der Grammatik. Oft steckt ein Ausdruck mit zwei Operatoren ohne Klammern dahinter: Hilde kennt keinen Vorrang von Operatoren.

Meldung:

Error:
  Title: Parse Error
  Error code: H0005
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 31
    To: line 3, column 32
  Description:
    Error during parse.
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         let total: Int32 := 1 +;
    4 |         printLn(total);
    5 |         return ExitSuccess();

Dieses Modul scheitert mit H0005:

module body Example is
    function main(): ExitCode is
        let total: Int32 := 1 +;
        printLn(total);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H0006

Der Funktionszeigertyp Fn steht ohne Typargumente. Er braucht mindestens eines, den Rückgabetyp, und davor die Typen der Parameter.

Meldung:

Error:
  Title: Parse Error
  Error code: H0006
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 4, column 8
  Description:
    Function pointer type specifier must have at least one argument.
  Code:
    1 | module body Example is
    2 |     function keep(callback: Fn): Unit is
    3 |         return nil;
    4 |     end;
    5 | 
    6 |     function main(): ExitCode is

Dieses Modul scheitert mit H0006:

module body Example is
    function keep(callback: Fn): Unit is
        return nil;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H0007

Ein Zeichen-Literal enthält mehr als ein Zeichen. Der Lexer nimmt zwischen den Apostrophen nur ein Zeichen oder ein Escape, also sieht der Parser nie ein längeres Literal; der einzige Weg dahin war ''', das jetzt der Apostroph ist, wie '\''.

Meldung:

Character literal '`lit` is more than one character.

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H0008

Ein reserviertes Wort steht, wo ein Name hingehört: der Name einer Funktion, eines let, eines var, einer Konstante, die Variable eines for, ein Parameter oder der Name nach as. Wörter wie method, from und body klingen nach guten Namen und sind trotzdem reserviert.

Meldung:

Error:
  Title: Parse Error
  Error code: H0008
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 13
    To: line 2, column 19
  Description:
    `method` is a reserved word and cannot be a name. Rename it, for example to `way`; docs/syntax.en.md, section 1, lists the reserved words.
    
    Suggested fix: `way`
  Code:
    1 | module body Example is
    2 |     function method(count: Int32): Int32 is
    3 |         return count;
    4 |     end;

Dieses Modul scheitert mit H0008:

module body Example is
    function method(count: Int32): Int32 is
        return count;
    end;

    function main(): ExitCode is
        printLn(method(1));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H0009

Hilde kennt keinen Vorrang: Ein Operator nimmt zwei atomare Operanden. Nur die assoziativen Operatoren +, *, and und or dürfen eine Kette aus demselben Operator bilden, a + b + c, gelesen von links. Folgt ein anderer Operator auf eine Operation, gehört diese Operation in Klammern. Die Meldung schlägt die Klammern um die Operation vor dem Operator vor.

Meldung:

Error:
  Title: Parse Error
  Error code: H0009
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 34
    To: line 3, column 35
  Description:
    Hilde has no operator precedence: an operator takes two operands, and only `+`, `*`, `and` and `or` can be chained with themselves. Put the operation before `*` in parentheses, as in `(a + b) * c`.
    
    Suggested fix: `(1 + 2)`
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         let total: Int32 := 1 + 2 * 3;
    4 |         printLn(total);
    5 |         return ExitSuccess();

Dieses Modul scheitert mit H0009:

module body Example is
    function main(): ExitCode is
        let total: Int32 := 1 + 2 * 3;
        printLn(total);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H0010

Ein Index steht hinter einem Namen. Das Ergebnis eines Aufrufs wird zuerst an einen Namen gebunden, und der Name wird indiziert.

Meldung:

Error:
  Title: Parse Error
  Error code: H0010
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 7, column 35
    To: line 7, column 36
  Description:
    An index stands after a name, not after a call. Bind the result of the call to a name first, `let text: Span[Nat8, R] := asSpan(&s);`, and index the name, `text[i]`.
  Code:
    5 | 
    6 |     function main(): ExitCode is
    7 |         let first: Nat8 := digits()[0];
    8 |         printLn(first);
    9 |         return ExitSuccess();

Dieses Modul scheitert mit H0010:

module body Example is
    function digits(): Span[Nat8, Static] is
        return "0123";
    end;

    function main(): ExitCode is
        let first: Nat8 := digits()[0];
        printLn(first);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H0011

Ausleihen lässt sich nur eine Variable. Ein Literal wird zuerst an einen Namen gebunden, und der Name wird ausgeliehen.

Meldung:

Error:
  Title: Parse Error
  Error code: H0011
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 23
    To: line 8, column 25
  Description:
    Only a variable can be borrowed, not the literal `21`. Bind the value to a name first, `let key: Nat64 := 21;`, and borrow the name, `&key`.
  Code:
     6 | 
     7 |     function main(): ExitCode is
     8 |         printLn(twice(&21));
     9 |         return ExitSuccess();
    10 |     end;

Dieses Modul scheitert mit H0011:

module body Example is
    generic [R: Region]
    function twice(value: &[Int32, R]): Int32 is
        return !value * 2;
    end;

    function main(): ExitCode is
        printLn(twice(&21));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H0012

Ein Feld steht hinter einem Namen. Das Ergebnis eines Aufrufs wird zuerst an einen Namen gebunden, und dann wird das Feld des Namens gelesen.

Meldung:

Error:
  Title: Parse Error
  Error code: H0012
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 12, column 32
    To: line 12, column 33
  Description:
    A field stands after a name, not after a call. Bind the result of the call to a name first, `let node: Node := nodeAt();`, and take the field of the name, `node.kind`.
  Code:
    10 | 
    11 |     function main(): ExitCode is
    12 |         let x: Int32 := origin().x;
    13 |         printLn(x);
    14 |         return ExitSuccess();

Dieses Modul scheitert mit H0012:

module body Example is
    record Point: Free is
        x: Int32;
        y: Int32;
    end;

    function origin(): Point is
        return Point(x => 3, y => 4);
    end;

    function main(): ExitCode is
        let x: Int32 := origin().x;
        printLn(x);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6018

In einem String-Literal verbindet ein Backslash mit folgendem Leerraum zwei Teile des Strings, und der Leerraum muss mit einem zweiten Backslash enden. Hier folgt auf den Leerraum etwas anderes.

Meldung:

Error:
  Title: Generic Error
  Error code: H6018
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 27
    To: line 3, column 28
  Description:
    Bad whitespace escape sequence
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         printLn("one \  two");
    4 |         return ExitSuccess();
    5 |     end;

Dieses Modul scheitert mit H6018:

module body Example is
    function main(): ExitCode is
        printLn("one \  two");
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6058

Das Escape \u{X} schreibt den Codepunkt X als UTF-8. X sind eine bis sechs Hexadezimalziffern, höchstens 10FFFF, und kein Surrogat, D800 bis DFFF.

Meldung:

Error:
  Title: Parse Error
  Error code: H6058
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 27
    To: line 3, column 28
  Description:
    A `\u{...}` escape takes one to six hexadecimal digits of a code point up to `10FFFF`, and no surrogate (`D800` to `DFFF`).
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         printLn("\u{110000}");
    4 |         return ExitSuccess();
    5 |     end;

Dieses Modul scheitert mit H6058:

module body Example is
    function main(): ExitCode is
        printLn("\u{110000}");
        return ExitSuccess();
    end;
end module body.

↑ nach oben

2. Typen

H2020

Eine Instanz nennt etwas, das keine Typklasse ist.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2020
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 4
    To: line 7, column 8
  Description:
    Cannot create an instance for `Point` because it is not a typeclass.
  Code:
    4 |     end;
    5 | 
    6 |     instance Point(Int32) is
    7 |     end;
    8 | 
    9 |     function main(): ExitCode is

Dieses Modul scheitert mit H2020:

module body Example is
    record Point: Free is
        x: Int32;
    end;

    instance Point(Int32) is
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2021

Eine Instanz definiert eine Methode, die ihre Typklasse nicht deklariert.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2021
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 4
    To: line 14, column 8
  Description:
    The typeclass `Describe` has no method named `explain`
  Code:
     4 |     end;
     5 | 
     6 |     instance Describe(Int32) is
     7 |         method describe(value: Int32): Int32 is
     8 |             return value;
     9 |         end;
    10 | 
    11 |         method explain(value: Int32): Int32 is
    12 |             return value;
    13 |         end;
    14 |     end;
    15 | 
    16 |     function main(): ExitCode is

Dieses Modul scheitert mit H2021:

module body Example is
    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    instance Describe(Int32) is
        method describe(value: Int32): Int32 is
            return value;
        end;

        method explain(value: Int32): Int32 is
            return value;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2022

Eine Instanz lässt eine Methode ihrer Typklasse aus. Die Meldung nennt die fehlenden Methoden.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2022
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 7, column 4
    To: line 11, column 8
  Description:
    The instance `Describe(Int32)` does not implement every method of the typeclass.
    
    Missing: `explain`.
    
    An instance has to implement every method the typeclass declares, even one whose body does nothing: a method that is simply absent cannot be reported at the call site, only much later and as an internal error.
  Code:
     5 |     end;
     6 | 
     7 |     instance Describe(Int32) is
     8 |         method describe(value: Int32): Int32 is
     9 |             return value;
    10 |         end;
    11 |     end;
    12 | 
    13 |     function main(): ExitCode is

Dieses Modul scheitert mit H2022:

module body Example is
    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
        method explain(value: T): Int32;
    end;

    instance Describe(Int32) is
        method describe(value: Int32): Int32 is
            return value;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2023

Der Parameter einer Typklasse ist im Universum Region deklariert. Eine Region ist kein Typ, eine Typklasse kann sich also nicht auf Regionen beziehen.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2023
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 4, column 8
  Description:
    The parameter for the typeclass `Measure` cannot be declared to be in the `Region` universe, because regions are distinct from types.
    
    Consider using one of `Type`, `Linear`, or `Free` instead.
  Code:
    1 | module body Example is
    2 |     typeclass Measure(R: Region) is
    3 |         method measure(value: Int32): Int32;
    4 |     end;
    5 | 
    6 |     function main(): ExitCode is

Dieses Modul scheitert mit H2023:

module body Example is
    typeclass Measure(R: Region) is
        method measure(value: Int32): Int32;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2024

Ein Record oder eine Union ist im Universum Region deklariert. Nur Typparameter können für Regionen stehen; ein deklarierter Typ gehört zu Free, Linear oder Type.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2024
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 4, column 8
  Description:
    The record `Point` was declared to belong to the `Region` universe, but regions are distinct from types.
    
    Consider using one of `Type`, `Linear`, or `Free` instead.
  Code:
    1 | module body Example is
    2 |     record Point: Region is
    3 |         x: Int32;
    4 |     end;
    5 | 
    6 |     function main(): ExitCode is

Dieses Modul scheitert mit H2024:

module body Example is
    record Point: Region is
        x: Int32;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2025

Eine Instanz nennt eine Typklasse, die im Modul nicht deklariert und nicht importiert ist.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2025
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 6, column 8
  Description:
    Cannot find typeclass with the name `Describe`
  Code:
    1 | module body Example is
    2 |     instance Describe(Int32) is
    3 |         method describe(value: Int32): Int32 is
    4 |             return value;
    5 |         end;
    6 |     end;
    7 | 
    8 |     function main(): ExitCode is

Dieses Modul scheitert mit H2025:

module body Example is
    instance Describe(Int32) is
        method describe(value: Int32): Int32 is
            return value;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2026

Ein Typparameter einer generischen Funktion kommt weder in ihren Parametern noch im Rückgabetyp vor; kein Aufruf könnte also festlegen, wofür er steht.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2026
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 5, column 8
  Description:
    The type parameter `T` does not appear anywhere in the signature of the function.
  Code:
    1 | module body Example is
    2 |     generic [T: Free]
    3 |     function answer(): Int32 is
    4 |         return 42;
    5 |     end;
    6 | 
    7 |     function main(): ExitCode is

Dieses Modul scheitert mit H2026:

module body Example is
    generic [T: Free]
    function answer(): Int32 is
        return 42;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2031

Eine Funktion oder Methode endet ohne return. Auch eine Funktion, die nichts zurückgibt, endet mit return nil. Jeder Pfad zählt: ein Pfad endet mit return, raise, dem Aufruf einer Funktion, die Never zurückgibt, wie abort, oder einem while, dessen Bedingung true ist. Ein if ohne else, das nur im then-Zweig zurückkehrt, lässt einen Pfad offen.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2031
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 19
  Description:
    The function `show` does not end in a return statement.
  Code:
    1 | module body Example is
    2 |     function show(n: Int32): Unit is
    3 |         printLn(n);
    4 |     end;
    5 | 

Dieses Modul scheitert mit H2031:

module body Example is
    function show(n: Int32): Unit is
        printLn(n);
    end;

    function main(): ExitCode is
        show(1);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2032

Das Argument einer generischen Instanz verwendet denselben Typparameter zweimal. Jeder Typparameter darf darin nur einmal vorkommen.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2032
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 11, column 4
    To: line 16, column 8
  Description:
    Generic instances can only use each type parameter once in the argument.
  Code:
     9 |     end;
    10 | 
    11 |     generic [U: Free]
    12 |     instance Describe(Pair[U, U]) is
    13 |         method describe(value: Pair[U, U]): Int32 is
    14 |             return 2;
    15 |         end;
    16 |     end;
    17 | 
    18 |     function main(): ExitCode is

Dieses Modul scheitert mit H2032:

module body Example is
    record Pair[A: Free, B: Free]: Free is
        left: A;
        right: B;
    end;

    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    generic [U: Free]
    instance Describe(Pair[U, U]) is
        method describe(value: Pair[U, U]): Int32 is
            return 2;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2033

Eine generische Instanz deklariert mehr Typparameter, als ihr Argument verwendet. Typparameter und die im Argument verwendeten Variablen müssen gleich viele sein.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2033
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 4
    To: line 15, column 8
  Description:
    The number of type parameters in the instance declaration must be the same as the number of type variables applied to the argument.
  Code:
     8 |     end;
     9 | 
    10 |     generic [U: Free, V: Free]
    11 |     instance Describe(Box[U]) is
    12 |         method describe(value: Box[U]): Int32 is
    13 |             return 1;
    14 |         end;
    15 |     end;
    16 | 
    17 |     function main(): ExitCode is

Dieses Modul scheitert mit H2033:

module body Example is
    record Box[A: Free]: Free is
        content: A;
    end;

    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    generic [U: Free, V: Free]
    instance Describe(Box[U]) is
        method describe(value: Box[U]): Int32 is
            return 1;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2034

Das Argument einer Instanz ist ein bloßer Typparameter. Eine Instanz gilt einem benannten Typ, dessen Argumente Typparameter sein dürfen.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2034
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 4
    To: line 11, column 8
  Description:
    Typeclass arguments cannot be lone type parameters.
  Code:
     4 |     end;
     5 | 
     6 |     generic [U: Free]
     7 |     instance Describe(U) is
     8 |         method describe(value: U): Int32 is
     9 |             return 1;
    10 |         end;
    11 |     end;
    12 | 
    13 |     function main(): ExitCode is

Dieses Modul scheitert mit H2034:

module body Example is
    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    generic [U: Free]
    instance Describe(U) is
        method describe(value: U): Int32 is
            return 1;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2035

Das Argument einer generischen Instanz mischt Typparameter mit konkreten Typen. Es verwendet entweder nur Typparameter oder gar keine.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2035
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 11, column 4
    To: line 16, column 8
  Description:
    The type `Int32` is not a type parameter, but generic instances must use either all type parameters or none of them in the argument.
    
    Consider adding another generic parameter with universe `Free`
  Code:
     9 |     end;
    10 | 
    11 |     generic [U: Free]
    12 |     instance Describe(Pair[U, Int32]) is
    13 |         method describe(value: Pair[U, Int32]): Int32 is
    14 |             return 2;
    15 |         end;
    16 |     end;
    17 | 
    18 |     function main(): ExitCode is

Dieses Modul scheitert mit H2035:

module body Example is
    record Pair[A: Free, B: Free]: Free is
        left: A;
        right: B;
    end;

    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    generic [U: Free]
    instance Describe(Pair[U, Int32]) is
        method describe(value: Pair[U, Int32]): Int32 is
            return 2;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2037

Ein Typparameter einer generischen Instanz heißt wie der Parameter ihrer Typklasse. Die beiden müssen verschieden heißen.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2037
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 4
    To: line 15, column 8
  Description:
    The type parameters in a generic instance declaration cannot have the same name as the type parameter in the corresponding typeclass. The colliding name is `T`.
    
    Give the type parameter of the instance another name.
  Code:
     8 |     end;
     9 | 
    10 |     generic [T: Free]
    11 |     instance Describe(Box[T]) is
    12 |         method describe(value: Box[T]): Int32 is
    13 |             return 1;
    14 |         end;
    15 |     end;
    16 | 
    17 |     function main(): ExitCode is

Dieses Modul scheitert mit H2037:

module body Example is
    record Box[A: Free]: Free is
        content: A;
    end;

    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    generic [T: Free]
    instance Describe(Box[T]) is
        method describe(value: Box[T]): Int32 is
            return 1;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3003

Ein Typparameter einer generischen Funktion müsste im selben Aufruf für zwei verschiedene Typen stehen.

Meldung:

Error:
  Title: Type Error
  Error code: H3003
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 10, column 32
  Description:
    The type parameter `T` cannot be bound to both `Int32` and `Bool`
  Code:
     8 |         let n: Int32 := 1;
     9 |         let flag: Bool := true;
    10 |         printLn(first(n, flag));
    11 |         return ExitSuccess();
    12 |     end;

Dieses Modul scheitert mit H3003:

module body Example is
    generic [T: Free]
    function first(a: T, b: T): T is
        return a;
    end;

    function main(): ExitCode is
        let n: Int32 := 1;
        let flag: Bool := true;
        printLn(first(n, flag));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3004

Ein Typargument liegt in einem Universum, das sein Typparameter nicht zulässt, etwa ein Linear-Typ, wo der Parameter Free verlangt.

Meldung:

Error:
  Title: Type Error
  Error code: H3004
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 12, column 8
    To: line 12, column 56
  Description:
    The type parameter `T` must be `Free` but `Ticket` is `Linear`
  Code:
    10 | 
    11 |     function main(): ExitCode is
    12 |         let ticket: Ticket := keep(Ticket(number => 1));
    13 |         let { number: Int32 } := ticket;
    14 |         printLn(number);

Dieses Modul scheitert mit H3004:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    generic [T: Free]
    function keep(value: T): T is
        return value;
    end;

    function main(): ExitCode is
        let ticket: Ticket := keep(Ticket(number => 1));
        let { number: Int32 } := ticket;
        printLn(number);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3007

Eine Instanz gilt einem Typ, dessen Universum die Typklasse nicht zulässt, etwa einem Linear-Typ für eine Klasse über Free-Typen.

Meldung:

Error:
  Title: Type Error
  Error code: H3007
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 4
    To: line 15, column 8
  Description:
    Cannot define an instance with argument `Ticket` because it should belong to the `Free` universe, but it is actually in the `Linear` universe.
  Code:
     8 |     end;
     9 | 
    10 |     instance Describe(Ticket) is
    11 |         method describe(value: Ticket): Int32 is
    12 |             let { number: Int32 } := value;
    13 |             return number;
    14 |         end;
    15 |     end;
    16 | 
    17 |     function main(): ExitCode is

Dieses Modul scheitert mit H3007:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    instance Describe(Ticket) is
        method describe(value: Ticket): Int32 is
            let { number: Int32 } := value;
            return number;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3008

Die beiden Operanden eines Rechenoperators haben verschiedene Typen. Hilde wandelt nichts stillschweigend um; ein Operand wird vorher umgewandelt.

Meldung:

Error:
  Title: Type Error
  Error code: H3008
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 8
    To: line 5, column 31
  Description:
    Both operands to an arithmetic expression must be compatible types. The LHS has type `Int32` but the RHS has type `Int64`.
  Code:
    3 |         let small: Int32 := 1;
    4 |         let large: Int64 := 2;
    5 |         printLn(small + large);
    6 |         return ExitSuccess();
    7 |     end;

Dieses Modul scheitert mit H3008:

module body Example is
    function main(): ExitCode is
        let small: Int32 := 1;
        let large: Int64 := 2;
        printLn(small + large);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3009

Ein Operand eines Rechenoperators ist keine Zahl.

Meldung:

Error:
  Title: Type Error
  Error code: H3009
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 29
  Description:
    Both operands of an arithmetic operator must be numeric types, but `Bool` is not.
  Code:
    2 |     function main(): ExitCode is
    3 |         let flag: Bool := true;
    4 |         printLn(flag + flag);
    5 |         return ExitSuccess();
    6 |     end;

Dieses Modul scheitert mit H3009:

module body Example is
    function main(): ExitCode is
        let flag: Bool := true;
        printLn(flag + flag);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3010

Ein Wert eines vorzeichenlosen Typs wird negiert. Nat8 bis Nat64, Index und ByteSize haben keine negativen Werte.

Meldung:

Error:
  Title: Type Error
  Error code: H3010
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 20
  Description:
    Negation is not defined for the unsigned type `Nat8`. Its values have no opposite inside the type.
  Code:
    2 |     function main(): ExitCode is
    3 |         let n: Nat8 := 5;
    4 |         printLn(-n);
    5 |         return ExitSuccess();
    6 |     end;

Dieses Modul scheitert mit H3010:

module body Example is
    function main(): ExitCode is
        let n: Nat8 := 5;
        printLn(-n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3012

Ein Wert wird negiert, dessen Typ keine Instanz der Typklasse TrappingNegation hat. Ein eigener Typ kann eine solche Instanz bekommen.

Meldung:

Error:
  Title: Type Error
  Error code: H3012
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 35
  Description:
    Negation is not defined for the type `Money`: it does not implement the typeclass `TrappingNegation`. Give it an instance if it should have a negation.
  Code:
     6 |     function main(): ExitCode is
     7 |         let debt: Money := Money(cents => 500);
     8 |         let credit: Money := -debt;
     9 |         printLn(credit.cents);
    10 |         return ExitSuccess();

Dieses Modul scheitert mit H3012:

module body Example is
    record Money: Free is
        cents: Int64;
    end;

    function main(): ExitCode is
        let debt: Money := Money(cents => 500);
        let credit: Money := -debt;
        printLn(credit.cents);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3020

Etwas, das weder eine Funktion noch eine Methode noch ein Funktionszeiger ist, wird aufgerufen.

Meldung:

Error:
  Title: Type Error
  Error code: H3020
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 22
  Description:
    The type `Int32` is neither a function, method or function pointer, and cannot be called.
  Code:
    2 |     function main(): ExitCode is
    3 |         let n: Int32 := 5;
    4 |         printLn(n(1));
    5 |         return ExitSuccess();
    6 |     end;

Dieses Modul scheitert mit H3020:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 5;
        printLn(n(1));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3021

Ein Funktionszeiger wird mit mehr oder weniger Argumenten aufgerufen, als sein Typ Parameter hat. Ein direkter Aufruf einer Funktion mit falscher Anzahl wird als H6026 gemeldet.

Meldung:

Error:
  Title: Type Error
  Error code: H3021
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 31
  Description:
    The callable `f` expects 2 arguments but 1 was given.
  Code:
     6 |     function main(): ExitCode is
     7 |         let f: Fn[Int32, Int32, Int32] := add;
     8 |         let sum: Int32 := f(1);
     9 |         printLn(sum);
    10 |         return ExitSuccess();

Dieses Modul scheitert mit H3021:

module body Example is
    function add(a: Int32, b: Int32): Int32 is
        return a + b;
    end;

    function main(): ExitCode is
        let f: Fn[Int32, Int32, Int32] := add;
        let sum: Int32 := f(1);
        printLn(sum);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3022

Ein case, das nach Namen bindet, lässt einen Fall der Union aus. Jeder Fall der Union braucht sein eigenes when.

Meldung:

Error:
  Title: Type Error
  Error code: H3022
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 13, column 17
  Description:
    Non-exhaustive case statement.
  Code:
     8 |     function main(): ExitCode is
     9 |         let s: Shape := Dot();
    10 |         case s of
    11 |             when Dot do
    12 |                 printLn(0);
    13 |         end case;
    14 |         return ExitSuccess();
    15 |     end;

Dieses Modul scheitert mit H3022:

module body Example is
    union Shape: Free is
        case Dot;
        case Circle is
            radius: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Dot();
        case s of
            when Dot do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3023

Ein case schaut in eine Union, die ein anderes Modul nur als opaken Typ exportiert. Nur eine öffentliche oder im selben Modul deklarierte Union lässt sich mit case zerlegen.

Meldung:

Error:
  Title: Type Error
  Error code: H3023
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 8
    To: line 10, column 17
  Description:
    Union must be public or from the same module to be used in a case statement.
  Code:
     3 | module body Example is
     4 |     function main(): ExitCode is
     5 |         case make() of
     6 |             when Dot do
     7 |                 printLn(0);
     8 |             when Circle(radius: Int32) do
     9 |                 printLn(radius);
    10 |         end case;
    11 |         return ExitSuccess();
    12 |     end;

Dieses Modul scheitert mit H3023:

import Library (Shape, make);

module body Example is
    function main(): ExitCode is
        case make() of
            when Dot do
                printLn(0);
            when Circle(radius: Int32) do
                printLn(radius);
        end case;
        return ExitSuccess();
    end;
end module body.

Daneben Library.hih:

module Library is
    type Shape: Free;

    function make(): Shape;
end module.

Daneben Library.hiq:

module body Library is
    union Shape: Free is
        case Dot;
        case Circle is
            radius: Int32;
    end;

    function make(): Shape is
        return Circle(radius => 2);
    end;
end module body.

↑ nach oben

H3024

Ein case, das nach Namen bindet, bekommt einen Wert eines benannten Typs, der keine Union ist, etwa einen Record.

Meldung:

Error:
  Title: Type Error
  Error code: H3024
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 11, column 17
  Description:
    The case expression has type `Point` which is not a union type.
  Code:
     6 |     function main(): ExitCode is
     7 |         let p: Point := Point(x => 1);
     8 |         case p of
     9 |             when Point(x: Int32) do
    10 |                 printLn(x);
    11 |         end case;
    12 |         return ExitSuccess();
    13 |     end;

Dieses Modul scheitert mit H3024:

module body Example is
    record Point: Free is
        x: Int32;
    end;

    function main(): ExitCode is
        let p: Point := Point(x => 1);
        case p of
            when Point(x: Int32) do
                printLn(x);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3025

Ein when, das nach Namen bindet, nennt Slots, die der Fall der Union nicht hat, oder lässt welche aus.

Meldung:

Error:
  Title: Type Error
  Error code: H3025
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 15, column 17
  Description:
    The set of slots (`diameter`) in the case statement doesn't match the set of slots in the union definition (`radius`).
  Code:
     8 |     function main(): ExitCode is
     9 |         let s: Shape := Circle(radius => 2);
    10 |         case s of
    11 |             when Dot do
    12 |                 printLn(0);
    13 |             when Circle(diameter: Int32) do
    14 |                 printLn(diameter);
    15 |         end case;
    16 |         return ExitSuccess();
    17 |     end;

Dieses Modul scheitert mit H3025:

module body Example is
    union Shape: Free is
        case Dot;
        case Circle is
            radius: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Circle(radius => 2);
        case s of
            when Dot do
                printLn(0);
            when Circle(diameter: Int32) do
                printLn(diameter);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3027

Ein Wert wird in einen Typ umgewandelt, der er nicht werden kann. Eine Typangabe e : T gibt nur einem Literal seinen Typ, macht aus einer Schreib- eine Lese-Referenz oder nennt einem generischen Aufruf seinen Rückgabetyp.

Meldung:

Error:
  Title: Type Error
  Error code: H3027
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 37
  Description:
    Cannot cast to `Int32` from `Bool`
  Code:
    2 |     function main(): ExitCode is
    3 |         let flag: Bool := true;
    4 |         let n: Int32 := flag : Int32;
    5 |         printLn(n);
    6 |         return ExitSuccess();

Dieses Modul scheitert mit H3027:

module body Example is
    function main(): ExitCode is
        let flag: Bool := true;
        let n: Int32 := flag : Int32;
        printLn(n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3029

Die Bedingung eines if, eines while oder eines if-Ausdrucks ist kein Bool.

Meldung:

Error:
  Title: Type Error
  Error code: H3029
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 6, column 15
  Description:
    The condition in `if`-statements should be a boolean type, but is `Int32`
  Code:
    2 |     function main(): ExitCode is
    3 |         let n: Int32 := 1;
    4 |         if n then
    5 |             printLn(n);
    6 |         end if;
    7 |         return ExitSuccess();
    8 |     end;

Dieses Modul scheitert mit H3029:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 1;
        if n then
            printLn(n);
        end if;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3030

Ein Record oder ein Fall einer Union wird mit Argumenten nach Position gebaut. Sein Konstruktor nimmt nur benannte Argumente.

Meldung:

Error:
  Title: Type Error
  Error code: H3030
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 36
  Description:
    Arguments to record constructor must be named.
  Code:
     6 | 
     7 |     function main(): ExitCode is
     8 |         let p: Point := Point(1, 2);
     9 |         printLn(p.x);
    10 |         return ExitSuccess();

Dieses Modul scheitert mit H3030:

module body Example is
    record Point: Free is
        x: Int32;
        y: Int32;
    end;

    function main(): ExitCode is
        let p: Point := Point(1, 2);
        printLn(p.x);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3031

Ein Konstruktor wird mit Namen aufgerufen, die nicht die Slots des Records oder des Falls sind.

Meldung:

Error:
  Title: Type Error
  Error code: H3031
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 46
  Description:
    Arguments to record constructor have the wrong names.
  Code:
     6 | 
     7 |     function main(): ExitCode is
     8 |         let p: Point := Point(x => 1, z => 2);
     9 |         printLn(p.x);
    10 |         return ExitSuccess();

Dieses Modul scheitert mit H3031:

module body Example is
    record Point: Free is
        x: Int32;
        y: Int32;
    end;

    function main(): ExitCode is
        let p: Point := Point(x => 1, z => 2);
        printLn(p.x);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3033

Ein let mit geschweiften Klammern zerlegt einen Wert eines eingebauten Typs, der keine Slots hat. Eine Union wird als H3053 gemeldet.

Meldung:

Error:
  Title: Type Error
  Error code: H3033
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 34
  Description:
    The type `Int32` cannot be destructured because it is not a record.
  Code:
    2 |     function main(): ExitCode is
    3 |         let n: Int32 := 5;
    4 |         let { value: Int32 } := n;
    5 |         printLn(value);
    6 |         return ExitSuccess();

Dieses Modul scheitert mit H3033:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 5;
        let { value: Int32 } := n;
        printLn(value);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3034

Ein let mit geschweiften Klammern zerlegt einen Record, den ein anderes Modul nur als opaken Typ exportiert. Seine Slots sind außerhalb seines Moduls nicht sichtbar.

Meldung:

Error:
  Title: Type Error
  Error code: H3034
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 8
    To: line 5, column 35
  Description:
    The type `Point` is not a public record and so cannot be destructured.
  Code:
    3 | module body Example is
    4 |     function main(): ExitCode is
    5 |         let { x: Int32 } := make();
    6 |         printLn(x);
    7 |         return ExitSuccess();

Dieses Modul scheitert mit H3034:

import Library (Point, make);

module body Example is
    function main(): ExitCode is
        let { x: Int32 } := make();
        printLn(x);
        return ExitSuccess();
    end;
end module body.

Daneben Library.hih:

module Library is
    type Point: Free;

    function make(): Point;
end module.

Daneben Library.hiq:

module body Library is
    record Point: Free is
        x: Int32;
    end;

    function make(): Point is
        return Point(x => 1);
    end;
end module body.

↑ nach oben

H3035

Ein let mit geschweiften Klammern nennt andere Slots, als der Record hat. Jeder Slot wird genannt, und kein anderer.

Meldung:

Error:
  Title: Type Error
  Error code: H3035
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 9, column 8
    To: line 9, column 30
  Description:
    The set of slots mentioned differs from the set of slots in `Point`
  Code:
     7 |     function main(): ExitCode is
     8 |         let p: Point := Point(x => 1, y => 2);
     9 |         let { x: Int32 } := p;
    10 |         printLn(x);
    11 |         return ExitSuccess();

Dieses Modul scheitert mit H3035:

module body Example is
    record Point: Free is
        x: Int32;
        y: Int32;
    end;

    function main(): ExitCode is
        let p: Point := Point(x => 1, y => 2);
        let { x: Int32 } := p;
        printLn(x);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3037

Eine Ausdrucksanweisung wirft ein Option oder ein Either weg. Ein solcher Wert trägt einen Fehlschlag, den jemand ansehen muss: mit case behandeln, mit ? weiterreichen oder mit ignore bewusst verwerfen.

Meldung:

Error:
  Title: Type Error
  Error code: H3037
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 16
  Description:
    The value of this expression has type `Option[Int32]`, which carries a failure the caller is meant to look at, so it may not be thrown away. Handle it with a case statement, hand it to your own caller with the ? operator, or, if the failure really is to be ignored here, say so in the program with ignore(...).
  Code:
     6 | 
     7 |     function main(): ExitCode is
     8 |         half(4);
     9 |         return ExitSuccess();
    10 |     end;

Dieses Modul scheitert mit H3037:

module body Example is
    function half(n: Int32): Option[Int32] is
        let r: Option[Int32] := Some(value => n / 2);
        return r;
    end;

    function main(): ExitCode is
        half(4);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3038

Der Operator ? steht an einem Wert, der weder Option noch Either ist; es gibt also keinen Fehlschlag weiterzureichen.

Meldung:

Error:
  Title: Type Error
  Error code: H3038
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 24
    To: line 3, column 26
  Description:
    The `?` operator hands a failure back to the caller, so it needs a value that can carry one: an `Option` or an `Either`. This expression has type `Int32`.
  Code:
    1 | module body Example is
    2 |     function twice(n: Int32): Option[Int32] is
    3 |         let m: Int32 := n?;
    4 |         let r: Option[Int32] := Some(value => m * 2);
    5 |         return r;

Dieses Modul scheitert mit H3038:

module body Example is
    function twice(n: Int32): Option[Int32] is
        let m: Int32 := n?;
        let r: Option[Int32] := Some(value => m * 2);
        return r;
    end;

    function main(): ExitCode is
        ignore(twice(2));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3039

Der Operator ? steht in einer Funktion, die den Fehlschlag nicht weiterreichen kann: Für ein Option muss sie ein Option zurückgeben, für ein Either ein Either mit demselben linken Typ.

Meldung:

Error:
  Title: Type Error
  Error code: H3039
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 24
    To: line 8, column 32
  Description:
    The `?` operator returns the failure out of the enclosing function, so that function has to be able to carry it. The operand has type `Option[Int32]` but the function returns `Int32`. For an Option the function must return an Option; for an Either it must return an Either whose left type is the same.
  Code:
     6 | 
     7 |     function quarter(n: Int32): Int32 is
     8 |         let h: Int32 := half(n)?;
     9 |         return h / 2;
    10 |     end;

Dieses Modul scheitert mit H3039:

module body Example is
    function half(n: Int32): Option[Int32] is
        let r: Option[Int32] := Some(value => n / 2);
        return r;
    end;

    function quarter(n: Int32): Int32 is
        let h: Int32 := half(n)?;
        return h / 2;
    end;

    function main(): ExitCode is
        printLn(quarter(8));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3040

Der Operator ? steht innerhalb eines größeren Ausdrucks. Er darf nur die ganze rechte Seite eines let oder eine ganze Anweisung sein, damit die vorzeitige Rückkehr in einer eigenen Zeile sichtbar ist.

Meldung:

Error:
  Title: Type Error
  Error code: H3040
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 24
    To: line 8, column 32
  Description:
    The `?` operator may only stand as the whole right-hand side of a `let` binding or as a whole statement. It is an early return out of the enclosing function, and it is written where that return is visible on its own line rather than buried inside a larger expression.
  Code:
     6 | 
     7 |     function quarter(n: Int32): Option[Int32] is
     8 |         let q: Int32 := half(n)? / 2;
     9 |         let r: Option[Int32] := Some(value => q);
    10 |         return r;

Dieses Modul scheitert mit H3040:

module body Example is
    function half(n: Int32): Option[Int32] is
        let r: Option[Int32] := Some(value => n / 2);
        return r;
    end;

    function quarter(n: Int32): Option[Int32] is
        let q: Int32 := half(n)? / 2;
        let r: Option[Int32] := Some(value => q);
        return r;
    end;

    function main(): ExitCode is
        ignore(quarter(8));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3041

Der Wert einer Konstanten ist kein konstanter Ausdruck, etwa ein Funktionsaufruf.

Meldung:

Error:
  Title: Type Error
  Error code: H3041
  Module:
    Example
  Location:
    [no span available]
  Description:
    The expression is not a valid constant expression.
  Code:
    [no span available]

Dieses Modul scheitert mit H3041:

module body Example is
    function five(): Int32 is
        return 5;
    end;

    constant limit: Int32 := five();

    function main(): ExitCode is
        printLn(limit);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3043

Ein Funktionszeiger wird mit benannten Argumenten aufgerufen. Ein Funktionszeiger behält die Namen der Parameter nicht; seine Argumente stehen deshalb nach Position.

Meldung:

Error:
  Title: Type Error
  Error code: H3043
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 44
  Description:
    You can't call a function pointer with a named argument list, because function pointers don't preserve parameter names, so we wouldn't know how to assign arguments to parameters.
  Code:
     6 |     function main(): ExitCode is
     7 |         let f: Fn[Int32, Int32, Int32] := add;
     8 |         let sum: Int32 := f(a => 1, b => 2);
     9 |         printLn(sum);
    10 |         return ExitSuccess();

Dieses Modul scheitert mit H3043:

module body Example is
    function add(a: Int32, b: Int32): Int32 is
        return a + b;
    end;

    function main(): ExitCode is
        let f: Fn[Int32, Int32, Int32] := add;
        let sum: Int32 := f(a => 1, b => 2);
        printLn(sum);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3044

Die beiden Zweige eines if-Ausdrucks haben verschiedene Typen.

Meldung:

Error:
  Title: Type Error
  Error code: H3044
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 43
  Description:
    The branches of the `if`-expression have different types: `Int32` and `Bool`
  Code:
    2 |     function main(): ExitCode is
    3 |         let flag: Bool := true;
    4 |         printLn(if flag then 1 else false);
    5 |         return ExitSuccess();
    6 |     end;

Dieses Modul scheitert mit H3044:

module body Example is
    function main(): ExitCode is
        let flag: Bool := true;
        printLn(if flag then 1 else false);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3045

Der Operand von not ist kein Bool.

Meldung:

Error:
  Title: Type Error
  Error code: H3045
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 23
  Description:
    The operand of a negation operator must be a boolean expression, but it has the type `Int32`
  Code:
    2 |     function main(): ExitCode is
    3 |         let n: Int32 := 1;
    4 |         printLn(not n);
    5 |         return ExitSuccess();
    6 |     end;

Dieses Modul scheitert mit H3045:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 1;
        printLn(not n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3046

Ein Operand von and oder or ist kein Bool.

Meldung:

Error:
  Title: Type Error
  Error code: H3046
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 8
    To: line 5, column 28
  Description:
    Both operands of a conjunction operator must be boolean expressions, but they have types `Int32` and `Bool`
  Code:
    3 |         let n: Int32 := 1;
    4 |         let flag: Bool := true;
    5 |         printLn(n and flag);
    6 |         return ExitSuccess();
    7 |     end;

Dieses Modul scheitert mit H3046:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 1;
        let flag: Bool := true;
        printLn(n and flag);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3049

Ein Record hat keinen Slot dieses Namens.

Meldung:

Error:
  Title: Type Error
  Error code: H3049
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 9, column 8
    To: line 9, column 21
  Description:
    The type `Point` has no slot with name `z`
  Code:
     7 |     function main(): ExitCode is
     8 |         let p: Point := Point(x => 1, y => 2);
     9 |         printLn(p.z);
    10 |         return ExitSuccess();
    11 |     end;

Dieses Modul scheitert mit H3049:

module body Example is
    record Point: Free is
        x: Int32;
        y: Int32;
    end;

    function main(): ExitCode is
        let p: Point := Point(x => 1, y => 2);
        printLn(p.z);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3050

Eine Methode einer Typklasse wird mit einem Wert aufgerufen, dessen Typ keine Instanz dieser Klasse hat.

Meldung:

Error:
  Title: Type Error
  Error code: H3050
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 8
    To: line 14, column 29
  Description:
    The typeclass `Describe` has no instance which matches for `Int32`
  Code:
    12 |     function main(): ExitCode is
    13 |         let n: Int32 := 5;
    14 |         printLn(describe(n));
    15 |         return ExitSuccess();
    16 |     end;

Dieses Modul scheitert mit H3050:

module body Example is
    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    instance Describe(Bool) is
        method describe(value: Bool): Int32 is
            return 1;
        end;
    end;

    function main(): ExitCode is
        let n: Int32 := 5;
        printLn(describe(n));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3052

Ein Slot wird aus einem Record gelesen, den ein anderes Modul nur als opaken Typ exportiert.

Meldung:

Error:
  Title: Type Error
  Error code: H3052
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 8
    To: line 6, column 21
  Description:
    The slot `x` is not publically visible in the type `Point` and so cannot be read.
  Code:
    4 |     function main(): ExitCode is
    5 |         let p: Point := make();
    6 |         printLn(p.x);
    7 |         return ExitSuccess();
    8 |     end;

Dieses Modul scheitert mit H3052:

import Library (Point, make);

module body Example is
    function main(): ExitCode is
        let p: Point := make();
        printLn(p.x);
        return ExitSuccess();
    end;
end module body.

Daneben Library.hih:

module Library is
    type Point: Free;

    function make(): Point;
end module.

Daneben Library.hiq:

module body Library is
    record Point: Free is
        x: Int32;
    end;

    function make(): Point is
        return Point(x => 1);
    end;
end module body.

↑ nach oben

H3053

Ein Slot wird aus einem Wert eines benannten Typs gelesen, der kein Record ist, etwa einer Union. Ein Wert eines eingebauten Typs wird als H3057 gemeldet.

Meldung:

Error:
  Title: Type Error
  Error code: H3053
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 10, column 26
  Description:
    Cannot take a path of the type `Shape` because it is not a record.
  Code:
     8 |     function main(): ExitCode is
     9 |         let s: Shape := Circle(radius => 2);
    10 |         printLn(s.radius);
    11 |         return ExitSuccess();
    12 |     end;

Dieses Modul scheitert mit H3053:

module body Example is
    union Shape: Free is
        case Dot;
        case Circle is
            radius: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Circle(radius => 2);
        printLn(s.radius);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3054

Eine Bindung in einem case-Zweig deklariert einen anderen Typ, als der Slot hat.

Meldung:

Error:
  Title: Type Error
  Error code: H3054
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 9, column 17
  Description:
    The slot `number` should have type `Int32` but is declared to have type `Int64`
  Code:
     2 |     function main(): ExitCode is
     3 |         let count: Option[Int32] := Some(value => 5);
     4 |         case count of
     5 |             when Some(value as number: Int64) do
     6 |                 printLn(number);
     7 |             when None do
     8 |                 printLn(0);
     9 |         end case;
    10 |         return ExitSuccess();
    11 |     end;

Dieses Modul scheitert mit H3054:

module body Example is
    function main(): ExitCode is
        let count: Option[Int32] := Some(value => 5);
        case count of
            when Some(value as number: Int64) do
                printLn(number);
            when None do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3055

Eine generische Funktion, deren Typparameter nur im Rückgabetyp vorkommt, wird an einer Stelle aufgerufen, die keinen Typ erwartet; ihr Typ lässt sich so nicht bestimmen. Eine Typangabe mit Doppelpunkt legt ihn fest.

Meldung:

Error:
  Title: Type Error
  Error code: H3055
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 23
  Description:
    `None` is generic but unconstrained, so its type is ambiguous: its type is `Option[T]`, and nothing here decides `T`.
    
    Give the value a type: declare the variable it goes into with one, or cast it.
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         ignore(None());
    4 |         return ExitSuccess();
    5 |     end;

Dieses Modul scheitert mit H3055:

module body Example is
    function main(): ExitCode is
        ignore(None());
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3056

In einer generischen Funktion wird eine Methode einer Typklasse auf einem Wert eines Typparameters aufgerufen, dem die Anforderung dieser Klasse fehlt.

Meldung:

Error:
  Title: Type Error
  Error code: H3056
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 21
  Description:
    The type parameter `T` does not implement the type class `Printable`
    
    Consider adding a constraint to the type parameter.
  Code:
    2 |     generic [T: Free]
    3 |     function show(value: T): Unit is
    4 |         print(value);
    5 |         return nil;
    6 |     end;

Dieses Modul scheitert mit H3056:

module body Example is
    generic [T: Free]
    function show(value: T): Unit is
        print(value);
        return nil;
    end;

    function main(): ExitCode is
        show(5);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3057

Ein Slot wird aus einem Wert eines eingebauten Typs gelesen, der keine Slots hat.

Meldung:

Error:
  Title: Type Error
  Error code: H3057
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 25
  Description:
    Can't access the slot `value` because the type `Int32` is not a record.
  Code:
    2 |     function main(): ExitCode is
    3 |         let n: Int32 := 5;
    4 |         printLn(n.value);
    5 |         return ExitSuccess();
    6 |     end;

Dieses Modul scheitert mit H3057:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 5;
        printLn(n.value);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3058

Der Index-Operator s[i] steht an einem Wert, der kein Span ist.

Meldung:

Error:
  Title: Type Error
  Error code: H3058
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 22
  Description:
    I can't use the array indexing operator here, because the type `Box` is not a span.
  Code:
     6 |     function main(): ExitCode is
     7 |         let b: Box := Box(value => 5);
     8 |         printLn(b[0]);
     9 |         return ExitSuccess();
    10 |     end;

Dieses Modul scheitert mit H3058:

module body Example is
    record Box: Free is
        value: Int32;
    end;

    function main(): ExitCode is
        let b: Box := Box(value => 5);
        printLn(b[0]);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3060

Ein Wert hat einen anderen Typ als den, den seine Stelle erwartet, etwa in einer return-Anweisung.

Meldung:

Error:
  Title: Type Error
  Error code: H3060
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 20
  Description:
    Expected a value of type `Int32`, but got a value of type `Bool`.
  Code:
    1 | module body Example is
    2 |     function answer(): Int32 is
    3 |         return true;
    4 |     end;
    5 | 

Dieses Modul scheitert mit H3060:

module body Example is
    function answer(): Int32 is
        return true;
    end;

    function main(): ExitCode is
        printLn(answer());
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3061

Eine generische Funktion verlangt von ihrem Typparameter eine Typklasse, und der dafür eingesetzte Typ hat keine Instanz dieser Klasse.

Meldung:

Error:
  Title: Type Error
  Error code: H3061
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 19
  Description:
    Type constraint not satisfied: the type `Point` does not implement the typeclass `Printable`.
    
    This constraint is for the type variable `T`.
  Code:
     6 |     function main(): ExitCode is
     7 |         let p: Point := Point(x => 1);
     8 |         printLn(p);
     9 |         return ExitSuccess();
    10 |     end;

Dieses Modul scheitert mit H3061:

module body Example is
    record Point: Free is
        x: Int32;
    end;

    function main(): ExitCode is
        let p: Point := Point(x => 1);
        printLn(p);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3062

Ein Ganzzahl-Literal passt nicht in seinen Typ.

Meldung:

Error:
  Title: Type Error
  Error code: H3062
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 27
  Description:
    The integer `300` does not fit the type `Nat8`.
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         let n: Nat8 := 300;
    4 |         printLn(n);
    5 |         return ExitSuccess();

Dieses Modul scheitert mit H3062:

module body Example is
    function main(): ExitCode is
        let n: Nat8 := 300;
        printLn(n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3063

Ein Typargument liegt in einem Universum, das sein Typparameter nicht annimmt, etwa ein Linear-Typ für einen Parameter in Free.

Meldung:

Error:
  Title: Type Error
  Error code: H3063
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 4
    To: line 12, column 8
  Description:
    The type parameter `T` is expected to be `Free` but the supplied argument is `Linear`
  Code:
     8 |     end;
     9 | 
    10 |     function unpack(box: Box[Ticket]): Unit is
    11 |         return nil;
    12 |     end;
    13 | 
    14 |     function main(): ExitCode is

Dieses Modul scheitert mit H3063:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    record Box[T: Free]: Free is
        content: T;
    end;

    function unpack(box: Box[Ticket]): Unit is
        return nil;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3064

Ein Typname ist unbekannt: Er ist im Modul nicht deklariert, nicht importiert und nicht eingebaut.

Meldung:

Error:
  Title: Type Error
  Error code: H3064
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 28
  Description:
    Unable to find a type with the name `Integer`.
    
    Consider importing it, if it is defined in another module.
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         let n: Integer := 1;
    4 |         printLn(n);
    5 |         return ExitSuccess();

Dieses Modul scheitert mit H3064:

module body Example is
    function main(): ExitCode is
        let n: Integer := 1;
        printLn(n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3065

Ein case, das nach Namen bindet, bekommt einen Wert, der weder eine Union noch eine Referenz auf eine Union ist.

Meldung:

Error:
  Title: Type Error
  Error code: H3065
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 9, column 17
  Description:
    The type for the expression in a case statement must be a union or a reference to a union, but I got `Int32`
  Code:
     2 |     function main(): ExitCode is
     3 |         let n: Int32 := 1;
     4 |         case n of
     5 |             when Some(value: Int32) do
     6 |                 printLn(value);
     7 |             when None do
     8 |                 printLn(0);
     9 |         end case;
    10 |         return ExitSuccess();
    11 |     end;

Dieses Modul scheitert mit H3065:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 1;
        case n of
            when Some(value: Int32) do
                printLn(value);
            when None do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3071

Ein case verwendet in einem when Muster und bindet in einem anderen Slots nach Name und Typ. Ein case tut in allen seinen whens das eine oder das andere.

Meldung:

Error:
  Title: Type Error
  Error code: H3071
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 15, column 17
  Description:
    The when of `Circle` binds its slots by name and type, but this case uses patterns in another when.
    
    A case either binds by name in every when, or uses patterns in every when: write the slots of `Circle` as patterns, one per slot in the order the union declares them.
  Code:
     8 |     function main(): ExitCode is
     9 |         let s: Shape := Circle(radius => 2);
    10 |         case s of
    11 |             when Dot | Circle(0) do
    12 |                 printLn(0);
    13 |             when Circle(radius: Int32) do
    14 |                 printLn(radius);
    15 |         end case;
    16 |         return ExitSuccess();
    17 |     end;

Dieses Modul scheitert mit H3071:

module body Example is
    union Shape: Free is
        case Dot;
        case Circle is
            radius: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Circle(radius => 2);
        case s of
            when Dot | Circle(0) do
                printLn(0);
            when Circle(radius: Int32) do
                printLn(radius);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3072

Ein case mit Mustern bekommt eine Referenz. Muster passen auf einen Wert; auf Referenzen arbeitet ein case, das nach Namen bindet.

Meldung:

Error:
  Title: Type Error
  Error code: H3072
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 15, column 17
  Description:
    A case with patterns takes a value, but this one is given a reference of type `&[Shape, Region<55>]`.
    
    Matching through a reference is not built; pass the value, or use the case that binds by name, which works on references.
  Code:
     8 |     function main(): ExitCode is
     9 |         let s: Shape := Circle(radius => 2);
    10 |         case &s of
    11 |             when Dot do
    12 |                 printLn(0);
    13 |             when Circle(r) do
    14 |                 printLn(r);
    15 |         end case;
    16 |         return ExitSuccess();
    17 |     end;

Dieses Modul scheitert mit H3072:

module body Example is
    union Shape: Free is
        case Dot;
        case Circle is
            radius: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Circle(radius => 2);
        case &s of
            when Dot do
                printLn(0);
            when Circle(r) do
                printLn(r);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3073

Eine Variable steht als ganzes Muster in einem case über einer Union. Sie würde auf jeden Wert passen, und ein case über einer Union hat keinen Auffangzweig: Jede Variante wird aufgeführt.

Meldung:

Error:
  Title: Type Error
  Error code: H3073
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 13, column 17
    To: line 13, column 22
  Description:
    The variable `other` would match every value of the union `Shape`, and a case over a union has no catch-all.
    
    List the variants; the compiler says which one is missing.
  Code:
    11 |             when Dot do
    12 |                 printLn(0);
    13 |             when other do
    14 |                 printLn(1);
    15 |         end case;

Dieses Modul scheitert mit H3073:

module body Example is
    union Shape: Free is
        case Dot;
        case Circle is
            radius: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Circle(radius => 2);
        case s of
            when Dot do
                printLn(0);
            when other do
                printLn(1);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3074

Ein Muster kann nie gewählt werden, weil die Muster davor schon jeden Wert erfassen, auf den es passt.

Meldung:

Error:
  Title: Type Error
  Error code: H3074
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 7, column 17
    To: line 7, column 18
  Description:
    The pattern `5` can never be chosen: every value it matches is matched by a pattern before it.
    
    Remove it, or move it before the pattern that covers it.
  Code:
    5 |             when 0 .. 9 do
    6 |                 printLn(1);
    7 |             when 5 do
    8 |                 printLn(2);
    9 |             when _ do

Dieses Modul scheitert mit H3074:

module body Example is
    function main(): ExitCode is
        let n: Nat8 := 5;
        case n of
            when 0 .. 9 do
                printLn(1);
            when 5 do
                printLn(2);
            when _ do
                printLn(3);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3075

Ein case mit Mustern lässt Werte aus. Die Meldung nennt einen davon; bei einer ganzen Zahl schließt eine Variable oder _ am Ende das case ab.

Meldung:

Error:
  Title: Type Error
  Error code: H3075
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 7, column 17
  Description:
    The case does not cover every value of `Nat8`: for example `10` matches no when.
    
    Add a when for it.  A case has no else; over an integer a variable or `_` finishes it.
  Code:
    2 |     function main(): ExitCode is
    3 |         let n: Nat8 := 5;
    4 |         case n of
    5 |             when 0 .. 9 do
    6 |                 printLn(1);
    7 |         end case;
    8 |         return ExitSuccess();
    9 |     end;

Dieses Modul scheitert mit H3075:

module body Example is
    function main(): ExitCode is
        let n: Nat8 := 5;
        case n of
            when 0 .. 9 do
                printLn(1);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3076

Ein Ganzzahl-Muster steht, wo der Wert keine ganze Zahl ist.

Meldung:

Error:
  Title: Type Error
  Error code: H3076
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 17
    To: line 5, column 18
  Description:
    The integer pattern `1` stands where the value has the type `Bool`, which is not an integer type.
  Code:
    3 |         let flag: Bool := true;
    4 |         case flag of
    5 |             when 1 do
    6 |                 printLn(1);
    7 |             when _ do

Dieses Modul scheitert mit H3076:

module body Example is
    function main(): ExitCode is
        let flag: Bool := true;
        case flag of
            when 1 do
                printLn(1);
            when _ do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3077

Ein Bool-Muster, true oder false, steht, wo der Wert kein Bool ist.

Meldung:

Error:
  Title: Type Error
  Error code: H3077
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 17
    To: line 5, column 21
  Description:
    `true` is a Bool pattern, but the value here has the type `Int32`.
  Code:
    3 |         let n: Int32 := 1;
    4 |         case n of
    5 |             when true do
    6 |                 printLn(1);
    7 |             when _ do

Dieses Modul scheitert mit H3077:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 1;
        case n of
            when true do
                printLn(1);
            when _ do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3078

Ein Literal oder eine Grenze eines Bereichs liegt außerhalb des Typs des Werts. Ein Muster schneidet ein Literal nie ab und rechnet es nie um.

Meldung:

Error:
  Title: Type Error
  Error code: H3078
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 17
    To: line 5, column 20
  Description:
    The literal `256` is outside `Nat8`, whose values are `0 .. 255`.
    
    A pattern never truncates or wraps a literal.
  Code:
    3 |         let n: Nat8 := 5;
    4 |         case n of
    5 |             when 256 do
    6 |                 printLn(1);
    7 |             when _ do

Dieses Modul scheitert mit H3078:

module body Example is
    function main(): ExitCode is
        let n: Nat8 := 5;
        case n of
            when 256 do
                printLn(1);
            when _ do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3079

Die untere Grenze eines Bereichs liegt über der oberen; der Bereich ist leer.

Meldung:

Error:
  Title: Type Error
  Error code: H3079
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 17
    To: line 5, column 23
  Description:
    The range `9 .. 0` is empty: its lower bound is above its upper bound.
    
    A range lists its lower bound first, and both bounds belong to it.
  Code:
    3 |         let n: Nat8 := 5;
    4 |         case n of
    5 |             when 9 .. 0 do
    6 |                 printLn(1);
    7 |             when _ do

Dieses Modul scheitert mit H3079:

module body Example is
    function main(): ExitCode is
        let n: Nat8 := 5;
        case n of
            when 9 .. 0 do
                printLn(1);
            when _ do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3080

Ein Gleitkomma-Literal steht als Muster. Zwei Gleitkommazahlen, die gleich aussehen, müssen nicht gleich sein; Gleitkommazahlen sind deshalb keine Muster. Man bindet den Wert und vergleicht im Rumpf.

Meldung:

Error:
  Title: Type Error
  Error code: H3080
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 17
    To: line 5, column 20
  Description:
    The float literal `1.5` cannot be a pattern.
    
    A pattern compares for equality, and two floats that print alike need not be equal.  Only integer and Bool literals are patterns; bind the value to a variable and compare it in the body.
  Code:
    3 |         let x: Int32 := 1;
    4 |         case x of
    5 |             when 1.5 do
    6 |                 printLn(1);
    7 |             when _ do

Dieses Modul scheitert mit H3080:

module body Example is
    function main(): ExitCode is
        let x: Int32 := 1;
        case x of
            when 1.5 do
                printLn(1);
            when _ do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3081

Ein String-Literal steht als Muster. Muster sind nur Ganzzahl- und Bool-Literale.

Meldung:

Error:
  Title: Type Error
  Error code: H3081
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 21
    To: line 5, column 22
  Description:
    A string literal cannot be a pattern.
    
    Only integer and Bool literals are patterns; bind the value to a variable and compare it in the body.
  Code:
    3 |         let x: Int32 := 1;
    4 |         case x of
    5 |             when "one" do
    6 |                 printLn(1);
    7 |             when _ do

Dieses Modul scheitert mit H3081:

module body Example is
    function main(): ExitCode is
        let x: Int32 := 1;
        case x of
            when "one" do
                printLn(1);
            when _ do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3082

Das Muster _ steht, wo der Wert nicht Free ist. Es würde einen linearen Wert fallen lassen, den niemand verbraucht; man bindet ihn an eine Variable und verbraucht ihn.

Meldung:

Error:
  Title: Type Error
  Error code: H3082
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 17, column 22
    To: line 17, column 23
  Description:
    `_` stands where the value has the type `Ticket`, which is not in the Free universe.
    
    It would drop that value without anyone consuming it.  Bind it to a variable and consume it in the body.
  Code:
    15 |             when Empty do
    16 |                 printLn(0);
    17 |             when Full(_) do
    18 |                 printLn(1);
    19 |         end case;

Dieses Modul scheitert mit H3082:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    union Slot: Linear is
        case Empty;
        case Full is
            ticket: Ticket;
    end;

    function main(): ExitCode is
        let s: Slot := Empty();
        case s of
            when Empty do
                printLn(0);
            when Full(_) do
                printLn(1);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3083

Ein Variantenmuster gibt mehr oder weniger Untermuster an, als die Variante Slots hat. Jeder Slot bekommt eines, in der Reihenfolge der Deklaration.

Meldung:

Error:
  Title: Type Error
  Error code: H3083
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 17
    To: line 14, column 29
  Description:
    The variant `Rectangle` has 2 slot(s), and the pattern gives 1 sub-pattern(s).
    
    A variant pattern gives one sub-pattern for every slot, in the order the union declares them, so that no slot is left out unseen.
  Code:
    12 |             when Dot do
    13 |                 printLn(0);
    14 |             when Rectangle(w) do
    15 |                 printLn(w);
    16 |         end case;

Dieses Modul scheitert mit H3083:

module body Example is
    union Shape: Free is
        case Dot;
        case Rectangle is
            width: Int32;
            height: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Dot();
        case s of
            when Dot do
                printLn(0);
            when Rectangle(w) do
                printLn(w);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3084

Die Alternativen eines when binden verschiedene Variablen. Der Rumpf läuft nach jeder von ihnen; alle binden deshalb dieselben Variablen.

Meldung:

Error:
  Title: Type Error
  Error code: H3084
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 13, column 29
    To: line 13, column 44
  Description:
    The alternatives of this when bind different variables: `a` is bound in one alternative and not in another.
    
    The body runs after any of them, so every alternative binds the same variables.
  Code:
    11 |         let s: Shape := Square(side => 2);
    12 |         case s of
    13 |             when Square(a) | Rectangle(b, _) do
    14 |                 printLn(1);
    15 |         end case;

Dieses Modul scheitert mit H3084:

module body Example is
    union Shape: Free is
        case Square is
            side: Int32;
        case Rectangle is
            width: Int32;
            height: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Square(side => 2);
        case s of
            when Square(a) | Rectangle(b, _) do
                printLn(1);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3085

Eine Variable hat in einer Alternative eines when einen Typ und in einer anderen einen anderen.

Meldung:

Error:
  Title: Type Error
  Error code: H3085
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 12, column 34
    To: line 12, column 35
  Description:
    The variable `x` has the type `Int8` in one alternative and `Int64` in another.
    
    The body runs after any of them, so a variable has one type in every alternative.
  Code:
    10 |         let v: Value := Small(n => 1);
    11 |         case v of
    12 |             when Small(x) | Large(x) do
    13 |                 printLn(1);
    14 |         end case;

Dieses Modul scheitert mit H3085:

module body Example is
    union Value: Free is
        case Small is
            n: Int8;
        case Large is
            n: Int64;
    end;

    function main(): ExitCode is
        let v: Value := Small(n => 1);
        case v of
            when Small(x) | Large(x) do
                printLn(1);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3086

Ein Muster bindet dieselbe Variable zweimal. Um zwei Teile zu vergleichen, bindet man beide unter verschiedenen Namen und vergleicht im Rumpf.

Meldung:

Error:
  Title: Type Error
  Error code: H3086
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 11, column 30
    To: line 11, column 31
  Description:
    The variable `a` is bound twice in one pattern.
    
    A pattern binds each variable once; to compare two parts, bind both and compare them in the body.
  Code:
     9 |         let s: Shape := Rectangle(width => 2, height => 2);
    10 |         case s of
    11 |             when Rectangle(a, a) do
    12 |                 printLn(a);
    13 |         end case;

Dieses Modul scheitert mit H3086:

module body Example is
    union Shape: Free is
        case Rectangle is
            width: Int32;
            height: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Rectangle(width => 2, height => 2);
        case s of
            when Rectangle(a, a) do
                printLn(a);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3087

Ein Name mit kleinem Anfangsbuchstaben hat Untermuster. Ein solcher Name ist eine Variable; Untermuster hat nur eine Variante, mit großem Anfangsbuchstaben.

Meldung:

Error:
  Title: Type Error
  Error code: H3087
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 13, column 17
    To: line 13, column 26
  Description:
    `circle` takes sub-patterns, but its name begins with a lower-case letter, which makes it a variable.
    
    Only a variant takes sub-patterns, and a variant's name begins with an upper-case letter.
  Code:
    11 |             when Dot do
    12 |                 printLn(0);
    13 |             when circle(r) do
    14 |                 printLn(r);
    15 |         end case;

Dieses Modul scheitert mit H3087:

module body Example is
    union Shape: Free is
        case Dot;
        case circle is
            radius: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Dot();
        case s of
            when Dot do
                printLn(0);
            when circle(r) do
                printLn(r);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3088

Ein Variantenmuster nennt einen Fall, den die Union nicht hat. Die Meldung zählt ihre Varianten auf.

Meldung:

Error:
  Title: Type Error
  Error code: H3088
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 13, column 17
    To: line 13, column 26
  Description:
    `Square` is not a variant of `Shape`.  Its variants are `Dot, Circle`.
  Code:
    11 |             when Dot do
    12 |                 printLn(0);
    13 |             when Square(r) do
    14 |                 printLn(r);
    15 |         end case;

Dieses Modul scheitert mit H3088:

module body Example is
    union Shape: Free is
        case Dot;
        case Circle is
            radius: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Dot();
        case s of
            when Dot do
                printLn(0);
            when Square(r) do
                printLn(r);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3089

Ein Variantenmuster steht, wo der Wert keine Union ist.

Meldung:

Error:
  Title: Type Error
  Error code: H3089
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 17
    To: line 5, column 24
  Description:
    `Some` is a variant pattern, but the value here has the type `Int32`, which is not a union.
  Code:
    3 |         let n: Int32 := 1;
    4 |         case n of
    5 |             when Some(x) do
    6 |                 printLn(x);
    7 |             when _ do

Dieses Modul scheitert mit H3089:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 1;
        case n of
            when Some(x) do
                printLn(x);
            when _ do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3090

Ein case mit Mustern bekommt einen Wert eines Typs, über den es nicht entscheiden kann. Muster entscheiden über eine Union, eine ganze Zahl oder ein Bool.

Meldung:

Error:
  Title: Type Error
  Error code: H3090
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 7, column 17
  Description:
    A case with patterns decides on a union, an integer or a Bool, but this value has the type `Float64`.
  Code:
    2 |     function main(): ExitCode is
    3 |         let x: Float64 := 1.0;
    4 |         case x of
    5 |             when y do
    6 |                 printLn(y);
    7 |         end case;
    8 |         return ExitSuccess();
    9 |     end;

Dieses Modul scheitert mit H3090:

module body Example is
    function main(): ExitCode is
        let x: Float64 := 1.0;
        case x of
            when y do
                printLn(y);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3091

Das Muster _ steht als ganzes Muster in einem case über einer Union. Ein case über einer Union hat keinen Auffangzweig: Jede Variante wird aufgeführt.

Meldung:

Error:
  Title: Type Error
  Error code: H3091
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 13, column 17
    To: line 13, column 18
  Description:
    `_` would match every value of the union `Shape`, and a case over a union has no catch-all.
    
    List the variants; the compiler says which one is missing.
  Code:
    11 |             when Dot do
    12 |                 printLn(0);
    13 |             when _ do
    14 |                 printLn(1);
    15 |         end case;

Dieses Modul scheitert mit H3091:

module body Example is
    union Shape: Free is
        case Dot;
        case Circle is
            radius: Int32;
    end;

    function main(): ExitCode is
        let s: Shape := Dot();
        case s of
            when Dot do
                printLn(0);
            when _ do
                printLn(1);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3092

Ein Bereich steht, wo der Wert keine ganze Zahl ist.

Meldung:

Error:
  Title: Type Error
  Error code: H3092
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 17
    To: line 5, column 23
  Description:
    The range `0 .. 1` stands where the value has the type `Bool`, which is not an integer type.
  Code:
    3 |         let flag: Bool := true;
    4 |         case flag of
    5 |             when 0 .. 1 do
    6 |                 printLn(1);
    7 |             when _ do

Dieses Modul scheitert mit H3092:

module body Example is
    function main(): ExitCode is
        let flag: Bool := true;
        case flag of
            when 0 .. 1 do
                printLn(1);
            when _ do
                printLn(0);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3093

Eine Schreib-Referenz auf einen Teil eines Werts wird über eine Lese-Referenz genommen. &!(path) braucht einen Pfad, der bei einer Schreib-Referenz beginnt; über eine Lese-Referenz liest nur &(path) den Teil.

Meldung:

Error:
  Title: Type Error
  Error code: H3093
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 19, column 8
    To: line 19, column 37
  Description:
    A write reference to part of a value needs a write reference to the value, but the path gives `&[Inner, R]`.
    
    Start the path from a write reference, or take a read reference with `&(...)`.
  Code:
    17 |     generic [R: Region]
    18 |     function clear(pair: &[Pair, R]): Unit is
    19 |         setValue(&!(pair->first), 0);
    20 |         return nil;
    21 |     end;

Dieses Modul scheitert mit H3093:

module body Example is
    record Inner: Linear is
        value: Int32;
    end;

    record Pair: Linear is
        first: Inner;
        second: Inner;
    end;

    generic [R: Region]
    function setValue(inner: &![Inner, R], value: Int32): Unit is
        inner->value := value;
        return nil;
    end;

    generic [R: Region]
    function clear(pair: &[Pair, R]): Unit is
        setValue(&!(pair->first), 0);
        return nil;
    end;

    function main(): ExitCode is
        let pair: Pair := Pair(first => Inner(value => 5), second => Inner(value => 0));
        clear(&pair);
        let { first: Inner, second: Inner } := pair;
        let { value as a: Int32 } := first;
        let { value as b: Int32 } := second;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3094

Eine Funktion gibt eine Referenz auf eine ihrer lokalen Variablen in einer Region zurück, die ihr Aufrufer wählt. Die Region des Aufrufers überdauert den Aufruf, die lokale Variable nicht.

Meldung:

Error:
  Title: Type Error
  Error code: H3094
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 8
    To: line 5, column 18
  Description:
    A reference made inside this function cannot be handed out as `R`.
    
    `R` is a region parameter of the function: the caller chooses it, and it outlives the call.  The reference here has the region `Region<55>`, which ends inside the function.
  Code:
    3 |     function local(n: Int32): &[Int32, R] is
    4 |         let x: Int32 := n;
    5 |         return &x;
    6 |     end;
    7 | 

Dieses Modul scheitert mit H3094:

module body Example is
    generic [R: Region]
    function local(n: Int32): &[Int32, R] is
        let x: Int32 := n;
        return &x;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3095

Der Rumpf einer generischen Funktion legt einen der Typparameter der Funktion fest. Was ein Typparameter bedeutet, wählt der Aufrufer; der Rumpf muss deshalb für jede Wahl funktionieren.

Meldung:

Error:
  Title: Type Error
  Error code: H3095
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 17
  Description:
    The type parameter `T` would have to be `Int32` here.
    
    The caller chooses the type parameters of a function; its body cannot fix one.
  Code:
    2 |     generic [T: Type]
    3 |     function pretend(n: Int32): T is
    4 |         return n;
    5 |     end;
    6 | 

Dieses Modul scheitert mit H3095:

module body Example is
    generic [T: Type]
    function pretend(n: Int32): T is
        return n;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4001

Ein als Free deklarierter Record oder eine solche Union enthält einen Slot eines Linear-Typs oder hat einen Typparameter, der nicht Free ist. Ein Free-Wert ließe sich kopieren, und der lineare Wert darin mit ihm.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4001
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 4
    To: line 8, column 8
  Description:
    `Wallet` was declared to belong to the `Free` universe, but it contains a type that belongs to the `Linear` universe.
  Code:
     4 |     end;
     5 | 
     6 |     record Wallet: Free is
     7 |         ticket: Ticket;
     8 |     end;
     9 | 
    10 |     function main(): ExitCode is

Dieses Modul scheitert mit H4001:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    record Wallet: Free is
        ticket: Ticket;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6026

Eine Funktion, eine Methode oder ein Konstruktor wird mit mehr oder weniger Argumenten aufgerufen, als sie Parameter hat.

Meldung:

Error:
  Title: Generic Error
  Error code: H6026
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 7, column 8
    To: line 7, column 24
  Description:
    Wrong number of arguments. Expected `2` and got `1`.
  Code:
    5 | 
    6 |     function main(): ExitCode is
    7 |         printLn(add(1));
    8 |         return ExitSuccess();
    9 |     end;

Dieses Modul scheitert mit H6026:

module body Example is
    function add(a: Int32, b: Int32): Int32 is
        return a + b;
    end;

    function main(): ExitCode is
        printLn(add(1));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6032

Eine Instanz verbindet eine Typklasse und einen Typ, die beide aus anderen Modulen stammen. Eine Instanz gehört in das Modul ihrer Typklasse oder ihres Typs.

Meldung:

Error:
  Title: Generic Error
  Error code: H6032
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 11, column 8
  Description:
    Orphan rule broken: typeclass and type are both foreign.
  Code:
     1 | module body Example is
     2 |     instance Printable(ExitCode) is
     3 |         method print(value: ExitCode): Unit is
     4 |             return nil;
     5 |         end;
     6 | 
     7 |         generic [R: Region]
     8 |         method printSpan(value: Span[ExitCode, R]): Unit is
     9 |             return nil;
    10 |         end;
    11 |     end;
    12 | 
    13 |     function main(): ExitCode is

Dieses Modul scheitert mit H6032:

module body Example is
    instance Printable(ExitCode) is
        method print(value: ExitCode): Unit is
            return nil;
        end;

        generic [R: Region]
        method printSpan(value: Span[ExitCode, R]): Unit is
            return nil;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6037

Eine Instanz einer Typklasse aus einem anderen Modul wird für einen eingebauten Typ angegeben. Ein eingebauter Typ gehört der Sprache und gilt deshalb in jedem Modul als fremd; man definiert einen eigenen Typ und gibt diesem die Instanz.

Meldung:

Error:
  Title: Generic Error
  Error code: H6037
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 6, column 8
  Description:
    Orphan rule broken: `Nat8` is a built-in type. It belongs to the language and not to the module that names it, so it is foreign in every module except Hilde.Pervasive and Hilde.Memory, and the typeclass is foreign here too. Define a type of your own and give that the instance.
  Code:
    1 | module body Example is
    2 |     instance TrappingNegation(Nat8) is
    3 |         method trappingNegate(value: Nat8): Nat8 is
    4 |             return value;
    5 |         end;
    6 |     end;
    7 | 
    8 |     function main(): ExitCode is

Dieses Modul scheitert mit H6037:

module body Example is
    instance TrappingNegation(Nat8) is
        method trappingNegate(value: Nat8): Nat8 is
            return value;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6038

Ein Typ bekommt eine zweite Instanz derselben Typklasse. In einem Programm hat ein Typ höchstens eine Instanz einer Typklasse, gleich welches Modul sie deklariert.

Meldung:

Error:
  Title: Generic Error
  Error code: H6038
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 12, column 4
    To: line 16, column 8
  Description:
    Instance overlaps: the typeclass already has an instance for `Bool`. The existing instance is in the module `Example`, the new one is in `Example`. In one program a type may have at most one instance of a typeclass, whichever module declares it.
  Code:
    10 |     end;
    11 | 
    12 |     instance Describe(Bool) is
    13 |         method describe(value: Bool): Int32 is
    14 |             return 2;
    15 |         end;
    16 |     end;
    17 | 
    18 |     function main(): ExitCode is

Dieses Modul scheitert mit H6038:

module body Example is
    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    instance Describe(Bool) is
        method describe(value: Bool): Int32 is
            return 1;
        end;
    end;

    instance Describe(Bool) is
        method describe(value: Bool): Int32 is
            return 2;
        end;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6039

Ein aufgerufener Name ist weder eine Funktion noch eine Methode noch eine sichtbare Variable.

Meldung:

Error:
  Title: Generic Error
  Error code: H6039
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 26
  Description:
    I can't find a callable named `twice`.
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         printLn(twice(2));
    4 |         return ExitSuccess();
    5 |     end;

Dieses Modul scheitert mit H6039:

module body Example is
    function main(): ExitCode is
        printLn(twice(2));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6041

Links in einer Zuweisung steht ein Parameter der Funktion. Parameter lassen sich nicht ändern; der Wert wird zuerst in ein var kopiert.

Meldung:

Error:
  Title: Generic Error
  Error code: H6041
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 19
  Description:
    Cannot assign a value to a function parameter.
  Code:
    1 | module body Example is
    2 |     function next(n: Int32): Int32 is
    3 |         n := n + 1;
    4 |         return n;
    5 |     end;

Dieses Modul scheitert mit H6041:

module body Example is
    function next(n: Int32): Int32 is
        n := n + 1;
        return n;
    end;

    function main(): ExitCode is
        printLn(next(1));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6042

Eine Zuweisung ändert eine mit let gebundene Variable. Eine Variable, die sich ändert, wird mit var gebunden.

Meldung:

Error:
  Title: Generic Error
  Error code: H6042
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 15
  Description:
    Cannot assign a value to `n` because it is immutable.
  Code:
    2 |     function main(): ExitCode is
    3 |         let n: Int32 := 1;
    4 |         n := 2;
    5 |         printLn(n);
    6 |         return ExitSuccess();

Dieses Modul scheitert mit H6042:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 1;
        n := 2;
        printLn(n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6045

Eine Variable heißt wie eine Deklaration des Moduls, etwa eine Funktion oder eine Konstante.

Meldung:

Error:
  Title: Generic Error
  Error code: H6045
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 8
    To: line 5, column 30
  Description:
    The variable `limit` collides with the name of a declaration.
  Code:
    3 | 
    4 |     function main(): ExitCode is
    5 |         let limit: Int32 := 6;
    6 |         printLn(limit);
    7 |         return ExitSuccess();

Dieses Modul scheitert mit H6045:

module body Example is
    constant limit: Int32 := 5;

    function main(): ExitCode is
        let limit: Int32 := 6;
        printLn(limit);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6048

Ein generischer Typ oder ein eingebauter Typ wie Pointer bekommt die falsche Anzahl von Typargumenten.

Meldung:

Error:
  Title: Generic Error
  Error code: H6048
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 45
  Description:
    The type `Option` expects `1` type arguments, but I only found `2` arguments.
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         let n: Option[Int32, Bool] := None();
    4 |         ignore(n);
    5 |         return ExitSuccess();

Dieses Modul scheitert mit H6048:

module body Example is
    function main(): ExitCode is
        let n: Option[Int32, Bool] := None();
        ignore(n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3105

Eine Einschränkung einer generischen Funktion nennt eine Typklasse, die das Modul der Funktion weder im Interface noch im Rumpf importiert. Ein Modul importiert jede Typklasse, die seine Einschränkungen nennen; ohne diese Prüfung hielte das den Compiler mit einem internen Fehler an.

Meldung:

Error:
  Title: Type Error
  Error code: H3105
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 8
    To: line 6, column 28
  Description:
    The typeclass `Sized` of a constraint is not imported here. A module, its interface too, imports every typeclass its constraints name, as in `import Shape (Sized);`.
  Code:
    4 | module body Example is
    5 |     function main(): ExitCode is
    6 |         printLn(measure(5));
    7 |         return ExitSuccess();
    8 |     end;

Dieses Modul scheitert mit H3105:

import Shape (Sized);
import Measure (measure);

module body Example is
    function main(): ExitCode is
        printLn(measure(5));
        return ExitSuccess();
    end;
end module body.

Daneben Shape.hih:

module Shape is
    typeclass Sized(T: Free) is
        method sizeOf(value: T): Int32;
    end;

    instance Sized(Int32);
end module.

Daneben Shape.hiq:

module body Shape is
    instance Sized(Int32) is
        method sizeOf(value: Int32): Int32 is
            return 4;
        end;
    end;
end module body.

Daneben Measure.hih:

module Measure is
    generic [T: Free(Sized)]
    function measure(value: T): Int32;
end module.

Daneben Measure.hiq:

module body Measure is
    generic [T: Free(Sized)]
    function measure(value: T): Int32 is
        return 0;
    end;
end module body.

↑ nach oben

H3106

Der Compiler deklariert eine aus C importierte Funktion unter einem eigenen Namen, also ist der C-Name im Text eines @embed nicht deklariert, und cc wies das Programm mit einer impliziten Deklaration ab. Aufgerufen wird stattdessen die Hilde-Funktion, die sie importiert. Eine Funktion, die die Laufzeit deklariert, ist auch unter ihrem C-Namen deklariert, und ein @embed darf sie aufrufen, während ein Modul sie importiert.

Meldung:

Error:
  Title: Type Error
  Error code: H3106
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 9, column 24
    To: line 9, column 52
  Description:
    The C text of this @embed names `abs`, a function the programme imports through pragma Foreign_Import as `cAbs`. The compiler declares an imported function under a name of its own, so in C the name `abs` is not declared. Call `cAbs` in Hilde instead.
  Code:
     7 | 
     8 |     function main(): ExitCode is
     9 |         let n: Int32 := @embed(Int32, "abs($1)", -3);
    10 |         printLn(n);
    11 |         return ExitSuccess();

Dieses Modul scheitert mit H3106:

pragma Unsafe_Module;

module body Example is
    pragma Foreign_Import(External_Name => "abs");
    function cAbs(n: Int32): Int32 is
    end;

    function main(): ExitCode is
        let n: Int32 := @embed(Int32, "abs($1)", -3);
        printLn(n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3107

Ein Vergleich wird zum Operator von C, der nur Skalare und Zeiger vergleicht. Zwei Spans, zwei Records oder zwei Unions kämen ohne diese Prüfung durch die Typprüfung, und cc wiese das erzeugte C mit ungültigen Operanden ab. Zwei Texte vergleicht man Byte für Byte mit Standard.Text.equal, einen Record mit einer Funktion, die seine Felder vergleicht. Eine Typvariable kommt hier durch; H3108 ist dieselbe Prüfung dort, wo ein Aufruf ihr ihren Typ gibt.

Meldung:

Error:
  Title: Type Error
  Error code: H3107
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 8
    To: line 7, column 15
  Description:
    The operator `=` compares numbers, Bool, Unit, references, addresses and pointers, but its operands have the type `Span[Nat8, Static]`.
    
    Compare the bytes of two texts with `Standard.Text.equal`.
  Code:
    3 |         let text: Span[Nat8, Static] := "export PATH";
    4 |         let word: Span[Nat8, Static] := spanPart(text, 0, 7);
    5 |         if word = "export " then
    6 |             printLn("an export");
    7 |         end if;
    8 |         return ExitSuccess();
    9 |     end;

Dieses Modul scheitert mit H3107:

module body Example is
    function main(): ExitCode is
        let text: Span[Nat8, Static] := "export PATH";
        let word: Span[Nat8, Static] := spanPart(text, 0, 7);
        if word = "export " then
            printLn("an export");
        end if;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3108

Die Typprüfung lässt einen Vergleich von Werten einer Typvariable durch, denn eine generische Funktion, die Zahlen vergleicht, ist richtig. Wo ein Aufruf der Variable einen Span, einen Record oder eine Union gibt, wird der Vergleich an dieser Instanz abgewiesen, wie H3107 ihn für einen ausgeschriebenen Typ abweist; ohne sie wiese cc das erzeugte C ab.

Meldung:

Error:
  Title: Type Error
  Error code: H3108
  Module:
    Example
  Location:
    [no span available]
  Description:
    The operator `=` compares numbers, Bool, Unit, references, addresses and pointers, but in a use of a generic function its operands have the type `Span[Nat8, Static]`.
    
    Take a function that compares two values as an argument, or a typeclass.
  Code:
    [no span available]

Dieses Modul scheitert mit H3108:

module body Example is
    generic [T: Free]
    function same(a: T, b: T): Bool is
        return a = b;
    end;

    function main(): ExitCode is
        let left: Span[Nat8, Static] := "a";
        let right: Span[Nat8, Static] := "a";
        printLn(same(left, right));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3111

Ein Aufruf einer Methode findet die gemeinte Instanz über den Typ, der für den Parameter der Klasse steht: in einem Argument oder in dem Typ, als den das Ergebnis genommen wird. Eine Methode, die den Parameter in keinem von beiden nennt, lässt jeden Aufruf ohne Instanz; bisher kam die Typprüfung bis zu einem solchen Aufruf und brach mit einem internen Fehler ab. Die Methode wird abgewiesen, wo die Typklasse sie deklariert.

Meldung:

Error:
  Title: Type Error
  Error code: H3111
  Module:
    Example
  Location:
    [no span available]
  Description:
    The method `size` names the parameter `T` of its typeclass neither in a parameter nor in its result, so no call can tell which instance it means.
    
    Give it a parameter of that type, a witness whose value it need not read.
  Code:
    [no span available]

Dieses Modul scheitert mit H3111:

module body Example is
    typeclass Sized(T: Free) is
        method size(): Index;
    end;

    instance Sized(Int32) is
        method size(): Index is
            return 4;
        end;
    end;

    function main(): ExitCode is
        printLn(size());
        return ExitSuccess();
    end;
end module body.

↑ nach oben

3. Linearität

H3036

Eine Ausdrucksanweisung wirft einen Wert eines Linear-Typs weg. Ein linearer Wert wird verbraucht: an eine Funktion übergeben, zurückgegeben oder zerlegt.

Meldung:

Error:
  Title: Type Error
  Error code: H3036
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 7, column 8
    To: line 7, column 28
  Description:
    Cannot discard a value in the `Linear` universe.
  Code:
    5 | 
    6 |     function main(): ExitCode is
    7 |         Ticket(number => 1);
    8 |         return ExitSuccess();
    9 |     end;

Dieses Modul scheitert mit H3036:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function main(): ExitCode is
        Ticket(number => 1);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4002

Eine lineare Variable verlässt ihren Gültigkeitsbereich, ohne verbraucht zu sein, etwa eine Variable, die ein when bindet und sein Rumpf nicht verwendet.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4002
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 9, column 8
    To: line 14, column 17
  Description:
    Forgot to consume a linear variable: `value`.
  Code:
     7 |         let ticket: Ticket := Ticket(number => 1);
     8 |         let held: Option[Ticket] := Some(value => ticket);
     9 |         case held of
    10 |             when Some(value: Ticket) do
    11 |                 skip;
    12 |             when None do
    13 |                 skip;
    14 |         end case;
    15 |         return ExitSuccess();
    16 |     end;

Dieses Modul scheitert mit H4002:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function main(): ExitCode is
        let ticket: Ticket := Ticket(number => 1);
        let held: Option[Ticket] := Some(value => ticket);
        case held of
            when Some(value: Ticket) do
                skip;
            when None do
                skip;
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4003

Eine lineare Variable von außerhalb einer Schleife wird im Rumpf verbraucht und bekommt vor dessen Ende keinen neuen Wert. Der nächste Durchlauf würde sie ein zweites Mal verwenden.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4003
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 13, column 8
    To: line 15, column 16
  Description:
    The  variable `ticket` was consumed in the loop, without afterwards being reassigned.
  Code:
    11 |     function main(): ExitCode is
    12 |         let ticket: Ticket := Ticket(number => 7);
    13 |         for i from 1 to 3 do
    14 |             printLn(redeem(ticket));
    15 |         end for;
    16 |         return ExitSuccess();
    17 |     end;

Dieses Modul scheitert mit H4003:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function redeem(ticket: Ticket): Int32 is
        let { number: Int32 } := ticket;
        return number;
    end;

    function main(): ExitCode is
        let ticket: Ticket := Ticket(number => 7);
        for i from 1 to 3 do
            printLn(redeem(ticket));
        end for;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4004

Die Zweige eines if oder eines case behandeln eine lineare Variable verschieden: einer verbraucht sie, ein anderer nicht.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4004
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 8
    To: line 18, column 15
  Description:
    The variable `ticket` is used inconsistently in the branches of an if statement. In one branch it is consumed while in the other it is not yet consumed.
  Code:
    12 |         let ticket: Ticket := Ticket(number => 7);
    13 |         let lucky: Bool := true;
    14 |         if lucky then
    15 |             printLn(redeem(ticket));
    16 |         else
    17 |             skip;
    18 |         end if;
    19 |         return ExitSuccess();
    20 |     end;

Dieses Modul scheitert mit H4004:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function redeem(ticket: Ticket): Int32 is
        let { number: Int32 } := ticket;
        return number;
    end;

    function main(): ExitCode is
        let ticket: Ticket := Ticket(number => 7);
        let lucky: Bool := true;
        if lucky then
            printLn(redeem(ticket));
        else
            skip;
        end if;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4005

Ein einziger Ausdruck verbraucht dieselbe lineare Variable zweimal, etwa als zwei Argumente eines Aufrufs.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4005
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 8
    To: line 14, column 38
  Description:
    The variable `ticket` is consumed multiple times within the same expression.
  Code:
    12 |     function main(): ExitCode is
    13 |         let ticket: Ticket := Ticket(number => 7);
    14 |         printLn(both(ticket, ticket));
    15 |         return ExitSuccess();
    16 |     end;

Dieses Modul scheitert mit H4005:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function both(a: Ticket, b: Ticket): Int32 is
        let { number as x: Int32 } := a;
        let { number as y: Int32 } := b;
        return x + y;
    end;

    function main(): ExitCode is
        let ticket: Ticket := Ticket(number => 7);
        printLn(both(ticket, ticket));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4008

Eine lineare Variable wird in einer späteren Anweisung ein zweites Mal verbraucht.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4008
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 8
    To: line 14, column 32
  Description:
    The variable `ticket` has already been consumed.
  Code:
    12 |         let ticket: Ticket := Ticket(number => 7);
    13 |         printLn(redeem(ticket));
    14 |         printLn(redeem(ticket));
    15 |         return ExitSuccess();
    16 |     end;

Dieses Modul scheitert mit H4008:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function redeem(ticket: Ticket): Int32 is
        let { number: Int32 } := ticket;
        return number;
    end;

    function main(): ExitCode is
        let ticket: Ticket := Ticket(number => 7);
        printLn(redeem(ticket));
        printLn(redeem(ticket));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4010

Einer var mit einem linearen Wert wird ein neuer Wert zugewiesen, bevor der alte verbraucht ist. Der alte Wert ginge verloren.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4010
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 13, column 8
    To: line 13, column 38
  Description:
    Cannot assign to the variable `ticket` because it is not yet consumed.
    
    A variable of a linear type takes a new value only after its old one is consumed, and None() of an Option of a linear type is such a value too. Consume the old value first, or give each branch its own value and return it there instead of collecting it in a var.
  Code:
    11 |     function main(): ExitCode is
    12 |         var ticket: Ticket := Ticket(number => 1);
    13 |         ticket := Ticket(number => 2);
    14 |         printLn(redeem(ticket));
    15 |         return ExitSuccess();

Dieses Modul scheitert mit H4010:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function redeem(ticket: Ticket): Int32 is
        let { number: Int32 } := ticket;
        return number;
    end;

    function main(): ExitCode is
        var ticket: Ticket := Ticket(number => 1);
        ticket := Ticket(number => 2);
        printLn(redeem(ticket));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4012

Eine lineare Variable ist nicht verbraucht, wenn die Funktion zurückkehrt.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4012
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 29
  Description:
    The variable `ticket` is not consumed by the time of the return statement. Did you forget to call a destructor, or destructure the contents?
  Code:
     6 |     function main(): ExitCode is
     7 |         let ticket: Ticket := Ticket(number => 7);
     8 |         return ExitSuccess();
     9 |     end;
    10 | end module body.

Dieses Modul scheitert mit H4012:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function main(): ExitCode is
        let ticket: Ticket := Ticket(number => 7);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4014

Eine Zuweisung an einen Slot schreibt einen Wert eines Typs, der nicht Free ist. Der alte Wert im Slot ginge verloren, ohne verbraucht zu sein.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4014
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 12, column 8
    To: line 12, column 45
  Description:
    Cannot assign to a path that ends in a type, `Ticket`, not in the Free universe.
  Code:
    10 |     function main(): ExitCode is
    11 |         var wallet: Wallet := Wallet(ticket => Ticket(number => 1));
    12 |         wallet.ticket := Ticket(number => 2);
    13 |         let { ticket: Ticket } := wallet;
    14 |         let { number: Int32 } := ticket;

Dieses Modul scheitert mit H4014:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    record Wallet: Linear is
        ticket: Ticket;
    end;

    function main(): ExitCode is
        var wallet: Wallet := Wallet(ticket => Ticket(number => 1));
        wallet.ticket := Ticket(number => 2);
        let { ticket: Ticket } := wallet;
        let { number: Int32 } := ticket;
        printLn(number);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4015

Von einem if-Ausdruck läuft ein Zweig. Eine lineare Variable, die nur ein Zweig verbraucht, bleibt auf dem anderen Weg unverbraucht. Beide Zweige verbrauchen sie, oder sie wird vor dem if verbraucht.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4015
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 8
    To: line 14, column 58
  Description:
    The variable `box` is consumed in one branch of an if expression and not in the other, so one path leaves it unconsumed.
    
    Consume it in both branches, or write the if as a statement whose branches each consume it.
  Code:
    12 |         let box: Box := Box(content => 7);
    13 |         let full: Bool := true;
    14 |         let value: Int32 := if full then open(box) else 0;
    15 |         printLn(value);
    16 |         return ExitSuccess();

Dieses Modul scheitert mit H4015:

module body Example is
    record Box: Linear is
        content: Int32;
    end;

    function open(box: Box): Int32 is
        let { content: Int32 } := box;
        return content;
    end;

    function main(): ExitCode is
        let box: Box := Box(content => 7);
        let full: Bool := true;
        let value: Int32 := if full then open(box) else 0;
        printLn(value);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

4. Borrowing

H3002

Eine Referenz oder ein Span wird an einen Task übergeben. Ein Task kann länger leben als die Ausleihe, aus der die Referenz stammt; sein Argument besitzt deshalb alles, worauf es zeigt.

Meldung:

Error:
  Title: Type Error
  Error code: H3002
  Module:
    Example
  Location:
    [no span available]
  Description:
    The argument of a task holds a reference or a span.
    
    A task can outlive the borrow the reference comes from, so what is handed to `Standard.Task.spawn` must own everything it points at.  Move the value in, or copy what the task needs.
  Code:
    [no span available]

Dieses Modul scheitert mit H3002:

import Standard.Task (Scope, openScope, closeScope, Task, spawn, join);

module body Example is
    generic [R: Region]
    function read(n: &[Index, R]): Index is
        return !n;
    end;

    function main(): ExitCode is
        let n: Index := 5;
        case openScope() of
            when Some(value as opened: Scope) do
                var scope: Scope := opened;
                borrow r: &[Index, rho] := &n do
                    let work: Fn[&[Index, rho], Index] := read;
                    case spawn(&!scope, work, r) of
                        when Right(right as task: Task[Index]) do
                            printLn(join(task));
                        when Left(left as back: &[Index, rho]) do
                            printLn(0);
                    end case;
                end borrow;
                closeScope(scope);
            when None do
                skip;
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3005

Der Pfeil -> liest einen Slot über eine Referenz, und der Wert davor ist keine Referenz. Einen Slot eines Record-Werts liest man mit einem Punkt.

Meldung:

Error:
  Title: Type Error
  Error code: H3005
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 22
  Description:
    The type `Point` is not a reference.
  Code:
     6 |     function main(): ExitCode is
     7 |         let p: Point := Point(x => 1);
     8 |         printLn(p->x);
     9 |         return ExitSuccess();
    10 |     end;

Dieses Modul scheitert mit H3005:

module body Example is
    record Point: Free is
        x: Int32;
    end;

    function main(): ExitCode is
        let p: Point := Point(x => 1);
        printLn(p->x);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3018

Eine mit let gebundene Variable wird zum Schreiben ausgeliehen. Eine Variable, die zum Schreiben ausgeliehen wird, wird mit var gebunden.

Meldung:

Error:
  Title: Type Error
  Error code: H3018
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 13, column 8
    To: line 13, column 52
  Description:
    Cannot borrow the variable `counter` mutably because the variable is immutable.
  Code:
    11 | 
    12 |     function main(): ExitCode is
    13 |         let counter: Counter := Counter(count => 0);
    14 |         bump(&!counter);
    15 |         let { count: Int32 } := counter;

Dieses Modul scheitert mit H3018:

module body Example is
    record Counter: Linear is
        count: Int32;
    end;

    generic [R: Region]
    function bump(counter: &![Counter, R]): Unit is
        counter->count := counter->count + 1;
        return nil;
    end;

    function main(): ExitCode is
        let counter: Counter := Counter(count => 0);
        bump(&!counter);
        let { count: Int32 } := counter;
        printLn(count);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3019

Ein Parameter einer Funktion wird zum Schreiben ausgeliehen. Parameter lassen sich nicht ändern; man übernimmt den Wert zuerst in ein var, wie die Meldung vorschlägt.

Meldung:

Error:
  Title: Type Error
  Error code: H3019
  Module:
    Example
  Location:
    Filename: ''
    From: line 0, column 0
    To: line 0, column 0
  Description:
    Cannot borrow the variable `counter` mutably because it is a function parameter, and therefore immutable.
    You can move it to a mutable local variable: `var mut_counter: Counter := counter;`
  Code:
    [no span available]

Dieses Modul scheitert mit H3019:

module body Example is
    record Counter: Linear is
        count: Int32;
    end;

    generic [R: Region]
    function bump(counter: &![Counter, R]): Unit is
        counter->count := counter->count + 1;
        return nil;
    end;

    function bumped(counter: Counter): Counter is
        bump(&!counter);
        return counter;
    end;

    function main(): ExitCode is
        let counter: Counter := bumped(Counter(count => 0));
        let { count: Int32 } := counter;
        printLn(count);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3026

Eine Schreib-Referenz wird mit Doppelpunkt in eine Lese-Referenz eines anderen Typs oder einer anderen Region umgewandelt. Die Umwandlung behält beides bei.

Meldung:

Error:
  Title: Type Error
  Error code: H3026
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 52
  Description:
    Cannot cast a reference to one with a different underlying type.
  Code:
     6 |     generic [R: Region]
     7 |     function peek(account: &![Account, R]): Int64 is
     8 |         let r: &[Int64, R] := account : &[Int64, R];
     9 |         return !r;
    10 |     end;

Dieses Modul scheitert mit H3026:

module body Example is
    record Account: Linear is
        balance: Int64;
    end;

    generic [R: Region]
    function peek(account: &![Account, R]): Int64 is
        let r: &[Int64, R] := account : &[Int64, R];
        return !r;
    end;

    function main(): ExitCode is
        var account: Account := Account(balance => 5);
        printLn(peek(&!account));
        let { balance: Int64 } := account;
        printLn(balance);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3028

Eine Schreib-Referenz wird mit Doppelpunkt in etwas umgewandelt, das keine Lese-Referenz ist.

Meldung:

Error:
  Title: Type Error
  Error code: H3028
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 40
  Description:
    Write references can only be casted to a read reference.
  Code:
     6 |     generic [R: Region]
     7 |     function peek(account: &![Account, R]): Int64 is
     8 |         let n: Int64 := account : Int64;
     9 |         return n;
    10 |     end;

Dieses Modul scheitert mit H3028:

module body Example is
    record Account: Linear is
        balance: Int64;
    end;

    generic [R: Region]
    function peek(account: &![Account, R]): Int64 is
        let n: Int64 := account : Int64;
        return n;
    end;

    function main(): ExitCode is
        var account: Account := Account(balance => 5);
        printLn(peek(&!account));
        let { balance: Int64 } := account;
        printLn(balance);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3032

Der Operator ! liest den Wert hinter einer Referenz und steht hier an etwas, das keine Referenz ist.

Meldung:

Error:
  Title: Type Error
  Error code: H3032
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 20
  Description:
    Only references can be dereferenced, but `Int32` is not.
  Code:
    2 |     function main(): ExitCode is
    3 |         let n: Int32 := 5;
    4 |         printLn(!n);
    5 |         return ExitSuccess();
    6 |     end;

Dieses Modul scheitert mit H3032:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 5;
        printLn(!n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3066

Ein Task eines Lending-Scopes bekommt eine Referenz aus einer anderen Ausleihe als der, aus der der Scope verleiht. Diese andere Ausleihe kann enden, bevor der Scope geschlossen ist.

Meldung:

Error:
  Title: Type Error
  Error code: H3066
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 18, column 24
    To: line 23, column 33
  Description:
    The argument of a task in a lending scope holds a reference of another region.
    
    A task started with `Standard.Task.spawnLending` may be lent only what the scope's own borrow lends -- the region the scope was opened for -- because only that borrow is sure to outlive the task.
  Code:
    16 |                     borrow i: &[Index, sigma] := &inner do
    17 |                         let work: Fn[&[Index, sigma], Index] := read;
    18 |                         case spawnLending(&!scope, work, i) of
    19 |                             when Right(right as task: Task[Index]) do
    20 |                                 printLn(join(task));
    21 |                             when Left(left as back: &[Index, sigma]) do
    22 |                                 printLn(0);
    23 |                         end case;
    24 |                     end borrow;
    25 |                     closeLending(scope);

Dieses Modul scheitert mit H3066:

import Standard.Task (Lending, openLending, closeLending, Task, spawnLending, join);

module body Example is
    generic [R: Region]
    function read(n: &[Index, R]): Index is
        return !n;
    end;

    function main(): ExitCode is
        let outer: Index := 1;
        let inner: Index := 2;
        borrow o: &[Index, rho] := &outer do
            case openLending(o) of
                when Some(value as opened: Lending[rho]) do
                    var scope: Lending[rho] := opened;
                    borrow i: &[Index, sigma] := &inner do
                        let work: Fn[&[Index, sigma], Index] := read;
                        case spawnLending(&!scope, work, i) of
                            when Right(right as task: Task[Index]) do
                                printLn(join(task));
                            when Left(left as back: &[Index, sigma]) do
                                printLn(0);
                        end case;
                    end borrow;
                    closeLending(scope);
                when None do
                    skip;
            end case;
        end borrow;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3067

Ein Task eines Lending-Scopes bekommt eine Schreib-Referenz. Tasks eines Lending-Scopes dürfen nur lesen, was ihnen geliehen wird.

Meldung:

Error:
  Title: Type Error
  Error code: H3067
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 18, column 24
    To: line 23, column 33
  Description:
    The argument of a task in a lending scope holds a write reference or a mutable span.
    
    Tasks of a lending scope may only read what they are lent; two tasks holding the same thing to write would each see the other's half-done change.
  Code:
    16 |                     borrow w: &![Index, sigma] := &!value do
    17 |                         let work: Fn[&![Index, sigma], Index] := read;
    18 |                         case spawnLending(&!scope, work, w) of
    19 |                             when Right(right as task: Task[Index]) do
    20 |                                 printLn(join(task));
    21 |                             when Left(left as back: &![Index, sigma]) do
    22 |                                 printLn(0);
    23 |                         end case;
    24 |                     end borrow;
    25 |                     closeLending(scope);

Dieses Modul scheitert mit H3067:

import Standard.Task (Lending, openLending, closeLending, Task, spawnLending, join);

module body Example is
    generic [R: Region]
    function read(n: &![Index, R]): Index is
        return !n;
    end;

    function main(): ExitCode is
        let anchor: Index := 1;
        var value: Index := 2;
        borrow a: &[Index, rho] := &anchor do
            case openLending(a) of
                when Some(value as opened: Lending[rho]) do
                    var scope: Lending[rho] := opened;
                    borrow w: &![Index, sigma] := &!value do
                        let work: Fn[&![Index, sigma], Index] := read;
                        case spawnLending(&!scope, work, w) of
                            when Right(right as task: Task[Index]) do
                                printLn(join(task));
                            when Left(left as back: &![Index, sigma]) do
                                printLn(0);
                        end case;
                    end borrow;
                    closeLending(scope);
                when None do
                    skip;
            end case;
        end borrow;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3068

Ein Task eines Lending-Scopes wird mit einem Argument gestartet, dessen Typ eine Typvariable ist. Wofür sie steht, ist dort, wo der Task startet, nicht bekannt; die Regionen lassen sich dort nicht prüfen.

Meldung:

Error:
  Title: Type Error
  Error code: H3068
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 11, column 8
    To: line 16, column 17
  Description:
    The argument of a task in a lending scope is of a type variable's type.
    
    What a type variable stands for is not known where `Standard.Task.spawnLending` is called, so it cannot be checked for references of another region.  Call it where the argument's type is written out.
  Code:
     9 |     generic [T: Free, R: Region, S: Region]
    10 |     function start(scope: &![Lending[R], S], work: Fn[T, Index], argument: T): Index is
    11 |         case spawnLending(scope, work, argument) of
    12 |             when Right(right as task: Task[Index]) do
    13 |                 return join(task);
    14 |             when Left(left as back: T) do
    15 |                 return 0;
    16 |         end case;
    17 |     end;
    18 | 

Dieses Modul scheitert mit H3068:

import Standard.Task (Lending, openLending, closeLending, Task, spawnLending, join);

module body Example is
    generic [R: Region]
    function read(n: &[Index, R]): Index is
        return !n;
    end;

    generic [T: Free, R: Region, S: Region]
    function start(scope: &![Lending[R], S], work: Fn[T, Index], argument: T): Index is
        case spawnLending(scope, work, argument) of
            when Right(right as task: Task[Index]) do
                return join(task);
            when Left(left as back: T) do
                return 0;
        end case;
    end;

    function main(): ExitCode is
        let n: Index := 5;
        borrow w: &[Index, rho] := &n do
            case openLending(w) of
                when Some(value as opened: Lending[rho]) do
                    var scope: Lending[rho] := opened;
                    let work: Fn[&[Index, rho], Index] := read;
                    printLn(start(&!scope, work, w));
                    closeLending(scope);
                when None do
                    skip;
            end case;
        end borrow;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3069

Ein Lending-Scope wird an einen Task eines anderen Lending-Scopes übergeben. Ein Task, der einen Scope hält, könnte ihn offen halten, nachdem seine Ausleihe geendet hat; ein Scope wird dort geschlossen, wo er geöffnet wurde.

Meldung:

Error:
  Title: Type Error
  Error code: H3069
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 19, column 28
    To: line 24, column 37
  Description:
    The argument of a task holds a lending scope.
    
    A task that held the scope could keep it open after the borrow it lends from has ended.  Close the scope where it was opened.
  Code:
    17 |                         when Some(value as other: Lending[rho]) do
    18 |                             let work: Fn[Lending[rho], Unit] := finish;
    19 |                             case spawnLending(&!scope, work, other) of
    20 |                                 when Right(right as task: Task[Unit]) do
    21 |                                     let done: Unit := join(task);
    22 |                                 when Left(left as back: Lending[rho]) do
    23 |                                     closeLending(back);
    24 |                             end case;
    25 |                         when None do
    26 |                             skip;

Dieses Modul scheitert mit H3069:

import Standard.Task (Lending, openLending, closeLending, Task, spawnLending, join);

module body Example is
    generic [R: Region]
    function finish(scope: Lending[R]): Unit is
        closeLending(scope);
        return nil;
    end;

    function main(): ExitCode is
        let n: Index := 5;
        borrow w: &[Index, rho] := &n do
            case openLending(w) of
                when Some(value as opened: Lending[rho]) do
                    var scope: Lending[rho] := opened;
                    case openLending(w) of
                        when Some(value as other: Lending[rho]) do
                            let work: Fn[Lending[rho], Unit] := finish;
                            case spawnLending(&!scope, work, other) of
                                when Right(right as task: Task[Unit]) do
                                    let done: Unit := join(task);
                                when Left(left as back: Lending[rho]) do
                                    closeLending(back);
                            end case;
                        when None do
                            skip;
                    end case;
                    closeLending(scope);
                when None do
                    skip;
            end case;
        end borrow;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3070

Ein Lending-Scope wird an einen Task eines gewöhnlichen Scopes übergeben. Der Task könnte den Lending-Scope offen halten, nachdem die Ausleihe, aus der er verleiht, geendet hat.

Meldung:

Error:
  Title: Type Error
  Error code: H3070
  Module:
    Example
  Location:
    [no span available]
  Description:
    The argument of a task holds a lending scope.
    
    A task that held the scope could keep it open after the borrow it lends from has ended.  Close the scope where it was opened.
  Code:
    [no span available]

Dieses Modul scheitert mit H3070:

import Standard.Task (Scope, openScope, closeScope, Lending, openLending, closeLending, Task, spawn, join);

module body Example is
    generic [R: Region]
    function finish(scope: Lending[R]): Unit is
        closeLending(scope);
        return nil;
    end;

    function main(): ExitCode is
        let n: Index := 5;
        case openScope() of
            when Some(value as opened: Scope) do
                var plain: Scope := opened;
                borrow w: &[Index, rho] := &n do
                    case openLending(w) of
                        when Some(value as lending: Lending[rho]) do
                            let work: Fn[Lending[rho], Unit] := finish;
                            case spawn(&!plain, work, lending) of
                                when Right(right as task: Task[Unit]) do
                                    let done: Unit := join(task);
                                when Left(left as back: Lending[rho]) do
                                    closeLending(back);
                            end case;
                        when None do
                            skip;
                    end case;
                end borrow;
                closeScope(plain);
            when None do
                skip;
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3112

Ein Wert eines mit pragma Thread_Bound markierten Typs oder eines Typs, der einen solchen enthält, wird einem Task übergeben, durch einen Kanal geschickt oder von einem Mutex bewacht. Ein solcher Wert hält Zustand des Threads, der ihn erzeugt hat, und ein Task kann auf jedem Worker-Thread laufen. Geprüft wird am instanziierten Typ, also wird auch eine generische Funktion abgelehnt, die den Wert weiterreicht. Geprüft werden Standard.Task.spawn und spawnLending (Argument und Ergebnis), Standard.Task.openChannel und Standard.Shared.makeMutex.

Meldung:

Error:
  Title: Type Error
  Error code: H3112
  Module:
    Example
  Location:
    [no span available]
  Description:
    A value of a thread-bound type would reach another task.
    
    The type given to `Standard.Task.spawn` holds `Example.Handle`, which is marked with `pragma Thread_Bound`: its value must stay on the thread that made it, and a task may run on another thread.  Keep the value where it was made.
  Code:
    [no span available]

Dieses Modul scheitert mit H3112:

import Standard.Task (Scope, openScope, closeScope, Task, spawn, join);

module body Example is
    pragma Thread_Bound;
    record Handle: Free is
        number: Int32;
    end;

    function read(handle: Handle): Int32 is
        return handle.number;
    end;

    function main(): ExitCode is
        case openScope() of
            when Some(value as opened: Scope) do
                var scope: Scope := opened;
                let work: Fn[Handle, Int32] := read;
                case spawn(&!scope, work, Handle(number => 7)) of
                    when Right(right as task: Task[Int32]) do
                        printLn(join(task));
                    when Left(left as back: Handle) do
                        printLn(back.number);
                end case;
                closeScope(scope);
            when None do
                skip;
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4006

Eine Variable wird verbraucht, während sie zum Lesen ausgeliehen ist.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4006
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 12
    To: line 14, column 36
  Description:
    The variable `ticket` cannot be consumed while it is borrowed (immutably).
  Code:
    12 |         let ticket: Ticket := Ticket(number => 7);
    13 |         borrow view: &[Ticket, R] := &ticket do
    14 |             printLn(redeem(ticket));
    15 |         end borrow;
    16 |         return ExitSuccess();

Dieses Modul scheitert mit H4006:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function redeem(ticket: Ticket): Int32 is
        let { number: Int32 } := ticket;
        return number;
    end;

    function main(): ExitCode is
        let ticket: Ticket := Ticket(number => 7);
        borrow view: &[Ticket, R] := &ticket do
            printLn(redeem(ticket));
        end borrow;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4007

Eine Variable wird verbraucht, während sie zum Schreiben ausgeliehen ist.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4007
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 12
    To: line 14, column 36
  Description:
    The variable `ticket` cannot be consumed while it is borrowed (mutably).
  Code:
    12 |         var ticket: Ticket := Ticket(number => 7);
    13 |         borrow view: &![Ticket, R] := &!ticket do
    14 |             printLn(redeem(ticket));
    15 |         end borrow;
    16 |         return ExitSuccess();

Dieses Modul scheitert mit H4007:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function redeem(ticket: Ticket): Int32 is
        let { number: Int32 } := ticket;
        return number;
    end;

    function main(): ExitCode is
        var ticket: Ticket := Ticket(number => 7);
        borrow view: &![Ticket, R] := &!ticket do
            printLn(redeem(ticket));
        end borrow;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4011

Eine Variable wird ausgeliehen, die schon verbraucht ist oder deren Zustand diese Art des Ausleihens nicht zulässt.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4011
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 8
    To: line 16, column 19
  Description:
    Cannot borrow (immutably) the variable `ticket` because it is already consumed.
  Code:
    12 |         let ticket: Ticket := Ticket(number => 7);
    13 |         printLn(redeem(ticket));
    14 |         borrow view: &[Ticket, R] := &ticket do
    15 |             printLn(view->number);
    16 |         end borrow;
    17 |         return ExitSuccess();
    18 |     end;

Dieses Modul scheitert mit H4011:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function redeem(ticket: Ticket): Int32 is
        let { number: Int32 } := ticket;
        return number;
    end;

    function main(): ExitCode is
        let ticket: Ticket := Ticket(number => 7);
        printLn(redeem(ticket));
        borrow view: &[Ticket, R] := &ticket do
            printLn(view->number);
        end borrow;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H4013

Der Operator ! liest den Wert hinter einer Referenz auf einen Typ, der nicht Free ist. Das Lesen würde einen linearen Wert kopieren.

Meldung:

Error:
  Title: Linearity Error
  Error code: H4013
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 9, column 12
    To: line 9, column 38
  Description:
    Cannot dereference non-free type `Ticket`
  Code:
     7 |         let ticket: Ticket := Ticket(number => 7);
     8 |         borrow view: &[Ticket, R] := &ticket do
     9 |             let copy: Ticket := !view;
    10 |             let { number: Int32 } := copy;
    11 |             printLn(number);

Dieses Modul scheitert mit H4013:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function main(): ExitCode is
        let ticket: Ticket := Ticket(number => 7);
        borrow view: &[Ticket, R] := &ticket do
            let copy: Ticket := !view;
            let { number: Int32 } := copy;
            printLn(number);
        end borrow;
        let { number: Int32 } := ticket;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6043

Eine Referenz-Transformation &( ... ) nimmt einen Pfad, dessen Kopf keine Referenz ist. Der Kopf ist eine Referenz, und der Pfad geht mit einem Pfeil weiter.

Meldung:

Error:
  Title: Generic Error
  Error code: H6043
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 42
  Description:
    The head of a reference transform expression must be of a reference type, but I got `Point`.
    
    A path into a value is borrowed through a reference to the whole value: write a function that takes `r: &[T, R]` and returns `&(r->slot)`, and call it with `&value`.
  Code:
     6 |     function main(): ExitCode is
     7 |         let p: Point := Point(x => 1);
     8 |         let r: &[Int32, Static] := &(p.x);
     9 |         printLn(!r);
    10 |         return ExitSuccess();

Dieses Modul scheitert mit H6043:

module body Example is
    record Point: Free is
        x: Int32;
    end;

    function main(): ExitCode is
        let p: Point := Point(x => 1);
        let r: &[Int32, Static] := &(p.x);
        printLn(!r);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6054

Eine Zuweisung schreibt über eine Lese-Referenz, die in einer var steht. Ändern lässt sich nur über eine Schreib-Referenz: zum Schreiben ausleihen und die Schreib-Referenz in die var legen.

Meldung:

Error:
  Title: Generic Error
  Error code: H6054
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 12
    To: line 10, column 22
  Description:
    Can't assign: lvalue is not a mutable reference: &[Int32, Region<56>]
  Code:
     8 |         borrow q: &[Point, R] := &p do
     9 |             var r: &[Point, R] := q;
    10 |             r->x := 0;
    11 |         end borrow;
    12 |         printLn(p.x);

Dieses Modul scheitert mit H6054:

module body Example is
    record Point: Free is
        x: Int32;
    end;

    function main(): ExitCode is
        let p: Point := Point(x => 1);
        borrow q: &[Point, R] := &p do
            var r: &[Point, R] := q;
            r->x := 0;
        end borrow;
        printLn(p.x);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6055

Eine borrow-Anweisung leiht mit &~ eine Variable weiter, die keine Schreib-Referenz ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H6055
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 10, column 19
  Description:
    Cannot reborrow something that is not a mutable reference: Point
  Code:
     6 |     function main(): ExitCode is
     7 |         var p: Point := Point(x => 1);
     8 |         borrow r: &![Point, R] := &~p do
     9 |             printLn(r->x);
    10 |         end borrow;
    11 |         return ExitSuccess();
    12 |     end;

Dieses Modul scheitert mit H6055:

module body Example is
    record Point: Free is
        x: Int32;
    end;

    function main(): ExitCode is
        var p: Point := Point(x => 1);
        borrow r: &![Point, R] := &~p do
            printLn(r->x);
        end borrow;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6059

Index und Feld werden über eine Ausleihe einer Variablen gelesen, und eine Konstante ist keine Variable. Die Konstante wird zuerst an eine lokale Variable gebunden, und diese wird indiziert.

Meldung:

Error:
  Title: Generic Error
  Error code: H6059
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 8
    To: line 5, column 27
  Description:
    `digits` is a constant of the module, and an index or a slot is taken through a variable, which a constant is not. Bind the constant to a local first, as in `let local: T := digits;`, and index the local.
  Code:
    3 | 
    4 |     function main(): ExitCode is
    5 |         printLn(digits[1]);
    6 |         return ExitSuccess();
    7 |     end;

Dieses Modul scheitert mit H6059:

module body Example is
    constant digits: Span[Nat8, Static] := "0123456789";

    function main(): ExitCode is
        printLn(digits[1]);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

5. Module

H2001

Der Body definiert einen Namen des Interfaces als eine andere Art von Deklaration, etwa als Funktion, wo das Interface eine Konstante deklariert.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2001
  Module:
    Example
  Location:
    Filename: 'Example.hih'
    From: line 2, column 4
    To: line 2, column 26
  Description:
    The interface requires `limit` to be a constant
  Code:
    1 | module Example is
    2 |     constant limit: Int32;
    3 | 
    4 |     function main(): ExitCode;

Dieses Modul scheitert mit H2001:

module body Example is
    function limit(): Int32 is
        return 5;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Example is
    constant limit: Int32;

    function main(): ExitCode;
end module.

↑ nach oben

H2002

Eine Funktion hat im Interface andere Typparameter, Parameter oder einen anderen Rückgabetyp als im Body. Die Meldung sagt, was sich unterscheidet.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2002
  Module:
    Example
  Location:
    Filename: 'Example.hih'
    From: line 2, column 4
    To: line 2, column 36
  Description:
    The interface declaration for `twice` and its implementation have different parameters.
  Code:
    1 | module Example is
    2 |     function twice(n: Int32): Int32;
    3 | 
    4 |     function main(): ExitCode;

Dieses Modul scheitert mit H2002:

module body Example is
    function twice(n: Int64): Int64 is
        return n * 2;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Example is
    function twice(n: Int32): Int32;

    function main(): ExitCode;
end module.

↑ nach oben

H2004

Das Interface deklariert etwas, das der Body nicht definiert.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2004
  Module:
    Example
  Location:
    [no span available]
  Description:
    `twice` has no corresponding body implementation.
  Code:
    [no span available]

Dieses Modul scheitert mit H2004:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Example is
    function twice(n: Int32): Int32;

    function main(): ExitCode;
end module.

↑ nach oben

H2005

Das Interface deklariert eine Instanz, die der Body nicht definiert.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2005
  Module:
    Example
  Location:
    [no span available]
  Description:
    The instance `Describe` with type `Int32` has no corresponding body implementation.
  Code:
    [no span available]

Dieses Modul scheitert mit H2005:

module body Example is
    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Example is
    typeclass Describe(T: Free) is
        method describe(value: T): Int32;
    end;

    instance Describe(Int32);

    function main(): ExitCode;
end module.

↑ nach oben

H2006

Interface und Body, die auf der Kommandozeile als Paar stehen, nennen verschiedene Module.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2006
  Module:
    Sample
  Location:
    [no span available]
  Description:
    Module interface and body have different names: `Sample` and `Example`
  Code:
    [no span available]

Dieses Modul scheitert mit H2006:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Sample is
    function main(): ExitCode;
end module.

↑ nach oben

H2008

Eine Deklaration hat im Interface einen anderen Typ als im Body, etwa eine Konstante.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2008
  Module:
    Example
  Location:
    Filename: 'Example.hih'
    From: line 2, column 4
    To: line 2, column 26
  Description:
    The interface declaration for `limit` and its implementation have different types.
  Code:
    1 | module Example is
    2 |     constant limit: Int32;
    3 | 
    4 |     function main(): ExitCode;

Dieses Modul scheitert mit H2008:

module body Example is
    constant limit: Int64 := 5;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Example is
    constant limit: Int32;

    function main(): ExitCode;
end module.

↑ nach oben

H2009

Ein opaker Typ ist im Interface in einem Universum deklariert und im Body in einem anderen definiert.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2009
  Module:
    Example
  Location:
    Filename: 'Example.hih'
    From: line 2, column 4
    To: line 2, column 22
  Description:
    The interface declaration for `Ticket` and its implementation have different universes.
  Code:
    1 | module Example is
    2 |     type Ticket: Free;
    3 | 
    4 |     function main(): ExitCode;

Dieses Modul scheitert mit H2009:

module body Example is
    record Ticket: Linear is
        number: Int32;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Example is
    type Ticket: Free;

    function main(): ExitCode;
end module.

↑ nach oben

H2010

Die Übersetzung wurde mit --forbid-unsafe-modules gestartet, und eines ihrer Module ist unsicher.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2010
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The module `Example` is unsafe, and this compilation was run with `--forbid-unsafe-modules`.
    
    It is `Example.hiq`, and it carries `pragma Unsafe_Module;`, which is what lets a module hold a foreign function, an `@embed`, or an import from `Hilde.Memory`.
    
    The modules that ship with the compiler are exempt; this applies to the modules named on the command line.
  Code:
    [no span available]

Dieses Modul scheitert mit H2010:

pragma Unsafe_Module;

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main --output=prog --forbid-unsafe-modules

↑ nach oben

H2011

Ein Pragma bekommt die falschen Argumente. Die Meldung sagt, welches Argument es nimmt oder dass es keines nimmt.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2011
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Invalid Foreign_Import pragma.
    
    This pragma takes exactly one argument, `External_Name`
  Code:
    [no span available]

Dieses Modul scheitert mit H2011:

pragma Unsafe_Module;

module body Example is
    pragma Foreign_Import(Name => "hilde_put_character");
    function putCharacter(character: Nat8): Int32 is
    end;

    function main(): ExitCode is
        putCharacter('a');
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2012

Ein Pragma hat einen Namen, den der Compiler nicht kennt. Die Pragmas heißen Unsafe_Module, Foreign_Library, Foreign_Header, Foreign_Import und Foreign_Export.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2012
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Unknown pragma `Unsafe_Modul`
  Code:
    [no span available]

Dieses Modul scheitert mit H2012:

pragma Unsafe_Modul;

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2013

Ein sicheres Modul nennt eine C-Bibliothek. Nur ein Modul mit pragma Unsafe_Module hat C, gegen das gelinkt wird.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2013
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Module `Example` is safe and can't name the C library `m`.
    
    A safe module has no C to link against: it can hold neither a `pragma Foreign_Import` nor an `@embed`. Write `pragma Unsafe_Module;` above `module body`, or take the library declaration out.
  Code:
    [no span available]

Dieses Modul scheitert mit H2013:

pragma Foreign_Library(Name => "m");

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2014

Der Name in pragma Foreign_Library ist leer. Er ist der Name einer Bibliothek, das z von -lz.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2014
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The name in a `pragma Foreign_Library` must not be empty.
    
    It is a library name, the `z` of `-lz`, not a linker switch.
  Code:
    [no span available]

Dieses Modul scheitert mit H2014:

pragma Unsafe_Module;
pragma Foreign_Library(Name => "");

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2015

Ein Modul deklariert denselben Namen zweimal.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2015
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 4
    To: line 8, column 8
  Description:
    A declaration with the name `twice` already exists in the module `Example`.
  Code:
     4 |     end;
     5 | 
     6 |     function twice(n: Int64): Int64 is
     7 |         return n * 2;
     8 |     end;
     9 | 
    10 |     function main(): ExitCode is

Dieses Modul scheitert mit H2015:

module body Example is
    function twice(n: Int32): Int32 is
        return n * 2;
    end;

    function twice(n: Int64): Int64 is
        return n * 2;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2016

Zwei Module einer Übersetzung haben denselben Namen.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2016
  Module:
    Example
  Location:
    [no span available]
  Description:
    A module with the name `Example` already exists.
  Code:
    [no span available]

Dieses Modul scheitert mit H2016:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben Library.hih:

module Example is
    function answer(): Int32;
end module.

Daneben Library.hiq:

module body Example is
    function answer(): Int32 is
        return 42;
    end;
end module body.

↑ nach oben

H2017

Ein Import nennt ein Modul, das nicht zur Übersetzung gehört. Trägt ein Modul der Übersetzung einen Namen, der nur wenige Buchstaben entfernt ist, fügt die Meldung Did you mean und diesen Namen an.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2017
  Module:
    Example
  Location:
    [no span available]
  Description:
    Unknown module `Library`.
  Code:
    [no span available]

Dieses Modul scheitert mit H2017:

import Library (answer);

module body Example is
    function main(): ExitCode is
        printLn(answer());
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2018

Eine über einen Typ generische Funktion trägt pragma Foreign_Export. C kann sie nicht aufrufen, weil sie keine einzige feste Form hat. Eine exportierte Funktion darf nur über Regionen generisch sein: Eine Region übergibt zur Laufzeit nichts, und die Funktion wird einmal gebaut, für die statische Region.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2018
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 4
    To: line 8, column 8
  Description:
    The function `keep` cannot be exported because it is generic over a type.
    
    An exported function may be generic over regions only: a region has nothing to pass at run time.
  Code:
     3 | module body Example is
     4 |     pragma Foreign_Export(External_Name => "example_keep");
     5 |     generic [T: Free]
     6 |     function keep(value: T): T is
     7 |         return value;
     8 |     end;
     9 | 
    10 |     function main(): ExitCode is

Dieses Modul scheitert mit H2018:

pragma Unsafe_Module;

module body Example is
    pragma Foreign_Export(External_Name => "example_keep");
    generic [T: Free]
    function keep(value: T): T is
        return value;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2027

Zwei Importe vergeben denselben lokalen Namen. Einer bekommt mit as einen anderen.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2027
  Module:
    Example
  Location:
    [no span available]
  Description:
    Colliding imports: a declaration with name `question` has already been imported.
    
    Consider giving it a different nickname using `as`, as in `import M (question as otherQuestion);`.
  Code:
    [no span available]

Dieses Modul scheitert mit H2027:

import Library (answer, question as answer);

module body Example is
    function main(): ExitCode is
        printLn(answer());
        return ExitSuccess();
    end;
end module body.

Daneben Library.hih:

module Library is
    function answer(): Int32;

    function question(): Int32;
end module.

Daneben Library.hiq:

module body Library is
    function answer(): Int32 is
        return 42;
    end;

    function question(): Int32 is
        return 6;
    end;
end module body.

↑ nach oben

H2028

Ein sicheres Modul importiert aus Hilde.Memory, dessen rohe Zeiger nur unsichere Module verwenden dürfen.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2028
  Module:
    Example
  Location:
    [no span available]
  Description:
    Cannot import from the `Hilde.Memory` module in a safe module.
    
    Consider using a safe wrapper or adding `pragma Unsafe_Module;`
  Code:
    [no span available]

Dieses Modul scheitert mit H2028:

import Hilde.Memory (Pointer);

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2029

Ein Import nennt etwas, das sein Modul nur im Body definiert. Was das Interface nicht deklariert, ist privat.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2029
  Module:
    Example
  Location:
    [no span available]
  Description:
    `secret` is private and cannot be imported.
  Code:
    [no span available]

Dieses Modul scheitert mit H2029:

import Library (secret);

module body Example is
    function main(): ExitCode is
        printLn(secret());
        return ExitSuccess();
    end;
end module body.

Daneben Library.hih:

module Library is
    function answer(): Int32;
end module.

Daneben Library.hiq:

module body Library is
    function answer(): Int32 is
        return secret();
    end;

    function secret(): Int32 is
        return 42;
    end;
end module body.

↑ nach oben

H2030

Ein Import nennt etwas, das sein Modul gar nicht hat.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2030
  Module:
    Example
  Location:
    [no span available]
  Description:
    No declaration with the name `question` in the module `Library`
  Code:
    [no span available]

Dieses Modul scheitert mit H2030:

import Library (question);

module body Example is
    function main(): ExitCode is
        printLn(question());
        return ExitSuccess();
    end;
end module body.

Daneben Library.hih:

module Library is
    function answer(): Int32;
end module.

Daneben Library.hiq:

module body Library is
    function answer(): Int32 is
        return 42;
    end;
end module body.

↑ nach oben

H2038

Ein sicheres Modul verwendet @embed, das C einfügt, das der Compiler nicht prüft. Das darf nur ein Modul mit pragma Unsafe_Module.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2038
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 24
    To: line 3, column 43
  Description:
    `@embed` pastes C straight into the generated program, and the compiler does not check that C. It is allowed only in a module that says so: write `pragma Unsafe_Module;` above `module body`, or move the `@embed` into a module that already has the pragma.
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         let n: Int32 := @embed(Int32, "42");
    4 |         printLn(n);
    5 |         return ExitSuccess();

Dieses Modul scheitert mit H2038:

module body Example is
    function main(): ExitCode is
        let n: Int32 := @embed(Int32, "42");
        printLn(n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2039

Ein sicheres Modul bindet mit pragma Foreign_Import eine C-Funktion.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2039
  Module:
    Example
  Location:
    [no span available]
  Description:
    Can't declare a foreign function in a safe module.
  Code:
    [no span available]

Dieses Modul scheitert mit H2039:

module body Example is
    pragma Foreign_Import(External_Name => "hilde_put_character");
    function putCharacter(character: Nat8): Int32 is
    end;

    function main(): ExitCode is
        putCharacter('a');
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2040

Eine mit Foreign_Import an C gebundene Funktion hat Typparameter. Eine C-Funktion hat eine einzige feste Signatur.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2040
  Module:
    Example
  Location:
    [no span available]
  Description:
    Foreign functions can't have type parameters.
  Code:
    [no span available]

Dieses Modul scheitert mit H2040:

pragma Unsafe_Module;

module body Example is
    pragma Foreign_Import(External_Name => "hilde_put_character");
    generic [T: Free]
    function putCharacter(character: T): Int32 is
    end;

    function main(): ExitCode is
        let c: Nat8 := 'a';
        putCharacter(c);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2041

Vor einer Funktion steht ein anderes Pragma als Foreign_Import oder Foreign_Export. Modul-Pragmas stehen vor module body.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2041
  Module:
    Example
  Location:
    [no span available]
  Description:
    Only import and export pragmas are allowed inside functions.
  Code:
    [no span available]

Dieses Modul scheitert mit H2041:

module body Example is
    pragma Unsafe_Module;
    function answer(): Int32 is
        return 42;
    end;

    function main(): ExitCode is
        printLn(answer());
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2042

Ein sicheres Modul nennt mit pragma Foreign_Header einen C-Header.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2042
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Module `Example` is safe and can't name the C header `sys/utsname.h`.
    
    A header gives C's own constants to an `@embed`, and a safe module can hold none. Write `pragma Unsafe_Module;` above `module body`, or take the header declaration out.
  Code:
    [no span available]

Dieses Modul scheitert mit H2042:

pragma Foreign_Header(Name => "sys/utsname.h");

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2043

Der Name in pragma Foreign_Header ist kein Header-Name. Er ist das, was zwischen den spitzen Klammern eines include steht: Buchstaben, Ziffern und _ . / + -, nicht mit einem Schrägstrich am Anfang und ohne einen Teil ..

Meldung:

Error:
  Title: Declaration Error
  Error code: H2043
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The name in a `pragma Foreign_Header` is not a header name: `../secret.h`
    
    It is what stands between the angle brackets of an `#include`, such as `openssl/evp.h`: letters, digits and `_ . / + -`, not empty, not starting with a slash, and without a `..` part.
  Code:
    [no span available]

Dieses Modul scheitert mit H2043:

pragma Unsafe_Module;
pragma Foreign_Header(Name => "../secret.h");

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2044

Ein Programm importiert sowohl Standard.Sqlite als auch Standard.SqlCipher. Die beiden C-Bibliotheken exportieren dieselben Funktionen; ein Programm linkt deshalb nur eine davon.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2044
  Module:
    Bindings.C.SqlCipher
  Location:
    [no span available]
  Description:
    This programme links both `sqlite3` and `sqlcipher`, which export the same functions.
    
    Import `Standard.Sqlite` or `Standard.SqlCipher`, not both.  The module that brought the second one is `Bindings.C.SqlCipher`.
  Code:
    [no span available]

Dieses Modul scheitert mit H2044:

import Standard.Sqlite (Connection);
import Standard.SqlCipher (Connection as CipherConnection);

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2045

Ein Programm importiert ein Modul, dessen Name mit Bindings. beginnt. Ein solches Modul bindet C an und ist unsafe; was seinen Aufruf sicher macht, prüft das Standard-Modul darüber, und das importiert ein Programm. Nur ein Modul, dessen Name mit Standard. oder Bindings. beginnt, darf es importieren.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2045
  Module:
    Example
  Location:
    [no span available]
  Description:
    `Example` imports from `Bindings.Time`, a module that binds C.
    
    Only the standard library imports a module whose name begins with `Bindings.`; a program imports the safe module built on it, whose name begins with `Standard.`.
  Code:
    [no span available]

Dieses Modul scheitert mit H2045:

import Bindings.Time (wallNanos);

module body Example is
    function main(): ExitCode is
        printLn(wallNanos() > 0);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2050

Der Name, unter dem eine Funktion exportiert wird, ist einer, den C ihr nicht geben kann: kein C-Bezeichner, ein Schlüsselwort von C oder main, ein Name, der mit hilde_ beginnt und den die Laufzeit für sich behält, oder ein Name, unter dem schon eine andere Funktion exportiert wird.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2050
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 4
    To: line 5, column 8
  Description:
    The function `keep` cannot be exported under the name `hilde_keep`: names beginning with hilde_ belong to the runtime.
  Code:
    1 | module body Example is
    2 |     pragma Foreign_Export(External_Name => "hilde_keep");
    3 |     function keep(value: Int32): Int32 is
    4 |         return value;
    5 |     end;
    6 | 
    7 |     function main(): ExitCode is

Dieses Modul scheitert mit H2050:

module body Example is
    pragma Foreign_Export(External_Name => "hilde_keep");
    function keep(value: Int32): Int32 is
        return value;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2059

Eine mit Foreign_Import an C gebundene Funktion gibt Bool zurück. Eine C-Funktion gibt einen Wahrheitswert als int, der für wahr jeder Wert außer 0 sein kann, und das erzeugte C liest davon nur das unterste Byte: isalpha der glibc antwortet für einen Buchstaben 1024, dessen unterstes Byte 0 ist. Das Ergebnis von C wird als Int32 importiert und in Hilde mit /= 0 verglichen.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2059
  Module:
    Example
  Location:
    [no span available]
  Description:
    A foreign function can't return `Bool`. C gives a truth value as an int, and a Bool would keep only its lowest byte, so 256 would be false.
    
    Import the C result as `Int32` and compare it with `/= 0`.
  Code:
    [no span available]

Dieses Modul scheitert mit H2059:

pragma Unsafe_Module;

module body Example is
    pragma Foreign_Import(External_Name => "isatty");
    function isTerminal(descriptor: Int32): Bool is
    end;

    function main(): ExitCode is
        let terminal: Bool := isTerminal(0);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2074

pragma Thread_Bound steht vor etwas, das keine Typdeklaration ist. Es markiert einen Record, eine Union oder einen opaken Typ eines Interfaces; vor einer Funktion, einer Konstante, einer Typklasse, einer Instanz oder einem Modul bedeutet es nichts.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2074
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 4
    To: line 5, column 8
  Description:
    `pragma Thread_Bound` stands right before the declaration of a type: a record, a union or a type of an interface.
    
    It marks the type, and every type that holds it, as one whose values must stay on the thread that made them.
  Code:
    1 | module body Example is
    2 |     pragma Thread_Bound;
    3 |     function main(): ExitCode is
    4 |         return ExitSuccess();
    5 |     end;
    6 | end module body.

Dieses Modul scheitert mit H2074:

module body Example is
    pragma Thread_Bound;
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3001

Eine mit Foreign_Export an C gegebene Funktion hat einen Parameter- oder Rückgabetyp, der nicht zu C hinüber kann, etwa einen Span aus etwas anderem als Nat8, einen Record mit Typparametern oder eine Referenz auf eine Zahl. Was hinüber kann und wie, steht in die Syntax beim Bau einer Bibliothek.

Meldung:

Error:
  Title: Type Error
  Error code: H3001
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The type `Span[Int32, R]` is not allowed in the signature of an exported function.
  Code:
    [no span available]

Dieses Modul scheitert mit H3001:

module body Example is
    pragma Foreign_Export(External_Name => "example_sum");
    generic [R: Region]
    function sum(words: Span[Int32, R]): Int32 is
        return 0;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6060

Die Funktion gibt es in einem anderen Modul, das die Meldung nennt, sie ist hier aber nicht importiert. Ein Interface importiert, was seine eigenen requires und ensures aufrufen: Ein Import des Modulrumpfs reicht nicht bis ins Interface.

Meldung:

Error:
  Title: Generic Error
  Error code: H6060
  Module:
    Example
  Location:
    Filename: 'Example.hih'
    From: line 3, column 8
    To: line 3, column 33
  Description:
    I can't find a callable named `size` here. The module `Other` declares one; import it, as in `import Other (size);`. A module interface imports what its own contracts call, apart from its body.
  Code:
    1 | module Example is
    2 |     function count(n: Int32): Int32
    3 |         ensures size(result) >= 0;
    4 | 
    5 |     function main(): ExitCode;

Dieses Modul scheitert mit H6060:

import Other (size);

module body Example is
    function count(n: Int32): Int32 is
        return size(n);
    end;

    function main(): ExitCode is
        printLn(count(3));
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Example is
    function count(n: Int32): Int32
        ensures size(result) >= 0;

    function main(): ExitCode;
end module.

Daneben Other.hih:

module Other is
    function size(n: Int32): Int32;
end module.

Daneben Other.hiq:

module body Other is
    function size(n: Int32): Int32 is
        return n;
    end;
end module body.

↑ nach oben

6. Anderes

H1001

Der Wert von --entrypoint hat nicht die Form Modul:Funktion.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1001
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Invalid entrypoint format `Example.main`
    
    The entrypoint must be supplied in the form `Module:name`
  Code:
    [no span available]

Dieses Modul scheitert mit H1001:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example.main --output=prog

↑ nach oben

H1002

Ein Modul auf der Kommandozeile steht weder als einzelne Body-Datei noch als Interface und Body, durch ein Komma verbunden.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1002
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Invalid module source format `Example.hiq,Example.hiq,Example.hiq`
    
    Sources must be supplied as either`interface.hih,body.hiq` or `body.hiq`
  Code:
    [no span available]

Dieses Modul scheitert mit H1002:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq,Example.hiq,Example.hiq --entrypoint=Example:main --output=prog

↑ nach oben

H1003

Das Kommando compile hat kein --entrypoint. Ein Programm braucht eines; eine C-Datei ohne Einstiegspunkt entsteht mit --target-type=c und --no-entrypoint.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1003
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `--entrypoint` argument not provided.
  Code:
    [no span available]

Dieses Modul scheitert mit H1003:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --output=prog

↑ nach oben

H1004

Das Kommando compile nennt kein Modul.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1004
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The `compile` command must specify at least one module.
  Code:
    [no span available]

Dieses Modul scheitert mit H1004:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile --entrypoint=Example:main --output=prog

↑ nach oben

H1005

Das Kommando compile hat kein --output.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1005
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `--output` argument not provided.
  Code:
    [no span available]

Dieses Modul scheitert mit H1005:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main

↑ nach oben

H1006

Der Compiler soll den Einstiegspunkt weglassen, und sein Ziel ist weder C noch eine Bibliothek. Ein Programm ohne Einstiegspunkt wird als C geschrieben oder als Bibliothek gebaut, damit ein Programm einer anderen Sprache es linken kann.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1006
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `--no-entrypoint` requires `--target-type=c`, `static`, `shared` or `wasm`, because otherwise the compiler will try to build an executable, and will fail because there is no entrypoint function.
  Code:
    [no span available]

Dieses Modul scheitert mit H1006:

module body Example is
    function answer(): Int32 is
        return 42;
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --no-entrypoint --output=prog

↑ nach oben

H1007

Der Wert von --target-type ist keiner von exe, c, tc, static und shared.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1007
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Unknown target type `binary`
  Code:
    [no span available]

Dieses Modul scheitert mit H1007:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main --output=prog --target-type=binary

↑ nach oben

H1008

Der Wert von --error-format ist keiner der Werte plain, json, hilde-json und json-lines.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1008
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Unknown error reporting mode: `xml`. Valid values are `plain`, `json`, `hilde-json` and `json-lines`.
  Code:
    [no span available]

Dieses Modul scheitert mit H1008:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main --output=prog --error-format=xml

↑ nach oben

H1009

Ein Flag steht zweimal da.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1009
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The argument `output` was given multiple times
  Code:
    [no span available]

Dieses Modul scheitert mit H1009:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main --output=prog --output=other

↑ nach oben

H1010

Die Argumentliste des Compilers ist leer, nicht einmal der Name des Programms steht darin. Eine Shell übergibt den Namen immer; nur ein Programm, das den Compiler ohne ihn startet, könnte diese Meldung erreichen.

Meldung:

Argument list must have at least one element in it, the path to the binary. Was the compiler invoked through a system call?

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1011

Ein Flag ohne Wert bekommt einen, wie in --flag=wert.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1011
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Expected `forbid-unsafe-modules` to be a boolean flag, but it was given as a value flag.
  Code:
    [no span available]

Dieses Modul scheitert mit H1011:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main --output=prog --forbid-unsafe-modules=yes

↑ nach oben

H1012

Ein Flag, das einen Wert nimmt, steht ohne Wert da.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1012
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Expected `output` to be a value flag, but it was given as a boolean flag.
  Code:
    [no span available]

Dieses Modul scheitert mit H1012:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main --output

↑ nach oben

H1013

Ein Flag enthält mehr als ein Gleichheitszeichen und ist damit weder --flag noch --flag=wert.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1013
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Invalid flag argument `--output=prog=bin`
  Code:
    [no span available]

Dieses Modul scheitert mit H1013:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main --output=prog=bin

↑ nach oben

H1014

Der C-Compiler hat den erzeugten C-Code abgelehnt. Bei einem richtigen Programm liegt das an C, das mit @embed eingefügt wurde, an einer fehlenden C-Bibliothek oder an einem Fehler im Compiler. Die Meldung zitiert das Kommando des C-Compilers und seine Ausgabe. Bei --target-type=static läuft nach dem C-Compiler der Archivierer ar(1); scheitert er, ist der Code derselbe, und die Meldung beginnt mit Failed to run the archiver ar.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1014
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Failed to run C compiler.
    
    Command: `'cc' '-std=c17' '-Wall' '-Wextra' '-O2' '-fno-strict-aliasing' '/tmp/hilde_de5c9c.c' '-lpthread' '-o' 'prog'`
    
    Exit code: 1
    
    Standard output:
    
    
    Standard error:
    /tmp/hilde_de5c9c.c: In function 'Example__main__d319':
    /tmp/hilde_de5c9c.c:7119:28: error: 'this' undeclared (first use in this function)
     7119 |     v_n = ((hilde_int32_t)(this is not C));
          |                            ^~~~
    /tmp/hilde_de5c9c.c:7119:28: note: each undeclared identifier is reported only once for each function it appears in
    /tmp/hilde_de5c9c.c:7119:32: error: expected ')' before 'is'
     7119 |     v_n = ((hilde_int32_t)(this is not C));
          |                           ~    ^~~
          |                                )
  Code:
    [no span available]

Dieses Modul scheitert mit H1014:

pragma Unsafe_Module;

module body Example is
    function main(): ExitCode is
        let n: Int32 := @embed(Int32, "this is not C");
        printLn(n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H1015

Der Compiler konnte seine Ausgabedatei nicht öffnen oder nicht schreiben, etwa weil ihr Verzeichnis fehlt oder das Gerät voll ist.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1015
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Failed to write to file `missing/Example.c`: 
    
    missing/Example.c: No such file or directory
  Code:
    [no span available]

Dieses Modul scheitert mit H1015:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main --target-type=c --output=missing/Example.c

↑ nach oben

H1016

Das ist die Meldung für ein Scheitern beim Schreiben, das kein Systemfehler ist; ein Systemfehler, etwa ein fehlendes Verzeichnis, ist H1015. Es fand sich kein Weg, das Schreiben anders scheitern zu lassen.

Meldung:

Failed to write to file ...

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1017

hilde query fragt nach einem Modul, das nicht auf der Kommandozeile steht.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1017
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The module `Sample` is not on the command line, so there is nothing to query.
  Code:
    [no span available]

Dieses Modul scheitert mit H1017:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde query Example.hiq --module=Sample

↑ nach oben

H1018

hilde query wird ohne --module aufgerufen und weiß daher nicht, welches Modul es beschreiben soll.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1018
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `hilde query` needs `--module=Name`: the module to describe.
  Code:
    [no span available]

Dieses Modul scheitert mit H1018:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde query Example.hiq

↑ nach oben

H1019

hilde test wird ohne Pfad aufgerufen und weiß daher nicht, wo es Tests suchen soll.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1019
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `hilde test` names no path: give the directories to search for test files, or test files by name.
  Code:
    [no span available]

Dieses Modul scheitert mit H1019:

module body Example.Test is
    function testNothing(): Unit is
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test

↑ nach oben

H1020

hilde test bekommt zwei Schalter, die einander ausschließen: zwei der Instrumente --race, --memory und --valgrind, oder --emit-c neben einem von ihnen.

ThreadSanitizer und AddressSanitizer lassen sich nicht in ein Programm bauen, und valgrind führt ein Programm aus, das ohne beide gebaut ist; --emit-c schreibt C und baut nichts, ein Instrument daneben bliebe also ohne Wirkung.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1020
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The flags `--race` and `--memory` of `hilde test` exclude one another.
    
    A run takes at most one of `--race`, `--memory` and `--valgrind`, and `--emit-c` builds and runs nothing, so it takes none of them.
  Code:
    [no span available]

Dieses Modul scheitert mit H1020:

module body Example.Test is
    function testNothing(): Unit is
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test --race --memory Example.hiq

↑ nach oben

H1021

hilde test bekommt ein Instrument, --race, --memory oder --valgrind, das dieses System nicht ausführen kann: Sein C-Compiler baut oder startet kein Programm mit den Schaltern des Instruments, valgrind lässt sich nicht starten, oder der C-Compiler findet valgrinds Header valgrind/valgrind.h nicht.

hilde test fragt, bevor es etwas baut: Ein Programm, das nichts tut, wird mit den Schaltern übersetzt und gestartet, und valgrind wird nach seiner Version gefragt und ein Programm übersetzt, das seinen Header liest. Die Laufzeit braucht den Header unter --valgrind: Sie meldet jeden Task-Stack bei valgrind an.

Meldung:

`hilde test <flag>` cannot run on this system: <what failed>
The answer was: <the first line the C compiler or valgrind wrote>

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1022

Ein Pfad, den hilde test bekommt, ist weder ein Verzeichnis noch eine .hiq-Datei, zum Beispiel weil es ihn nicht gibt.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1022
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `missing` is neither a directory nor a file ending in .hiq.
  Code:
    [no span available]

Dieses Modul scheitert mit H1022:

module body Example.Test is
    function testNothing(): Unit is
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test missing

↑ nach oben

H1023

hilde test hat die Verzeichnisse durchsucht, die es bekam, und darin keine Testdatei gefunden.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1023
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    There is no test file under `.`.
    
    A test file is a module body whose file name ends in .test.hiq, or a .hiq file named on the command line.
  Code:
    [no span available]

Dieses Modul scheitert mit H1023:

module body Example is
    function double(n: Nat32): Nat32 is
        return n * 2;
    end;
end module body.

Mit diesem Aufruf:

hilde test .

↑ nach oben

H1024

Zwei Dateien unter den Pfaden von hilde test deklarieren dasselbe Modul, und eine Testdatei importiert es.

Ein Name, den zwei Dateien deklarieren, wird nur abgelehnt, wenn ein Testprogramm ihn braucht; sonst in den Verzeichnissen schadet er nicht.

Meldung:

FAIL  ./Example.test.hiq  the test programme did not build
hilde test: 1 test file, 0 tests, 0 failed, 1 not built
Error:
  Title: Command Line Arguments Error
  Error code: H1024
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The module `Example` is declared by two files, `./Example.hiq` and `./Other.hiq`, and a test programme imports it, so there is no telling which one it means.
  Code:
    [no span available]

Dieses Modul scheitert mit H1024:

module body Example is
    function double(n: Nat32): Nat32 is
        return n * 2;
    end;
end module body.

Daneben Other.hiq:

module body Example is
    function double(n: Nat32): Nat32 is
        return n + n;
    end;
end module body.

Daneben Example.test.hiq:

import Example (double);

module body Example.Test is
    function testDouble(): Unit is
        if double(2) /= 4 then
            abort("double(2) is not 4");
        end if;
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test .

↑ nach oben

H1025

Ein Verzeichnis, in dem hilde test Module sucht, enthält ein Interface ohne den Rumpf gleichen Namens daneben.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1025
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The interface `./Other.hih` has no body `./Other.hiq` beside it, so its module cannot be compiled.
  Code:
    [no span available]

Dieses Modul scheitert mit H1025:

module body Example is
    function double(n: Nat32): Nat32 is
        return n * 2;
    end;
end module body.

Daneben Other.hih:

module Other is
    function half(n: Nat32): Nat32;
end module.

Daneben Example.test.hiq:

import Example (double);

module body Example.Test is
    function testDouble(): Unit is
        if double(2) /= 4 then
            abort("double(2) is not 4");
        end if;
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test .

↑ nach oben

H1026

Eine Bibliothek wird gebaut, --target-type=static, shared oder wasm, und die Kommandozeile nennt dazu einen Einstiegspunkt. Eine Bibliothek hat keinen Einstiegspunkt: C ruft die Funktionen auf, die sie exportiert, nach hilde_start.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1026
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `--target-type=static` builds a library, and a library has no entrypoint: `--entrypoint` cannot be given with it.
    
    The functions a library offers are the ones marked `pragma Foreign_Export`, called from C after `hilde_start`.
  Code:
    [no span available]

Dieses Modul scheitert mit H1026:

module body Example is
    pragma Foreign_Export(External_Name => "example_twice");
    function twice(x: Int32): Int32 is
        return x * 2;
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --target-type=static --entrypoint=Example:main --output=libexample.a

↑ nach oben

H1027

Die Ausgabe einer Bibliothek endet nicht auf die Endung ihrer Art, .a für --target-type=static und .so für shared, oder ist nur die Endung. Der Header wird neben die Bibliothek geschrieben, unter demselben Namen mit der Endung .h, also muss der Name sagen, wo seine Endung beginnt.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1027
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The output of `--target-type=shared` must end in `.so`, and `libexample.a` does not.
    
    The header is written beside the library under the same name ending in `.h`.
  Code:
    [no span available]

Dieses Modul scheitert mit H1027:

module body Example is
    pragma Foreign_Export(External_Name => "example_twice");
    function twice(x: Int32): Int32 is
        return x * 2;
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --target-type=shared --output=libexample.a

↑ nach oben

H1028

hilde test --contracts bekommt einen Seed oder eine Zahl von Runden, die keine Dezimalzahl in ihrem Bereich ist.

Ein Seed ist ein Nat64, von 0 bis 18446744073709551615, weil er als solcher in das Programm geschrieben wird, das die Eingaben zieht; die Runden reichen von 1 bis 100000, weil ein Lauf ohne Runden nichts testen würde.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1028
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The value of `--seed` is `18446744073709551616`, which is not a decimal number from 0 to 18446744073709551615.
  Code:
    [no span available]

Dieses Modul scheitert mit H1028:

module body Example.Test is
    function testNothing(): Unit is
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test --contracts --seed=18446744073709551616 Example.hiq

↑ nach oben

H1029

hilde test bekommt --seed oder --rounds ohne --contracts.

Nur ein Lauf, der Verträge testet, zieht Eingaben; ohne ihn bliebe der Schalter ohne Wirkung, und ein Schalter ohne Wirkung wird abgewiesen statt übergangen.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1029
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `--seed` is read only by `hilde test --contracts`, and this run has no `--contracts`.
    
    Add `--contracts`, or leave the flag out.
  Code:
    [no span available]

Dieses Modul scheitert mit H1029:

module body Example.Test is
    function testNothing(): Unit is
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test --seed=7 Example.hiq

↑ nach oben

H1030

hilde guard bekommt einen Einstiegspunkt, der keine Funktion eines Moduls auf seiner Kommandozeile ist.

Der Gang über die Aufrufe des Programms beginnt beim Einstiegspunkt; ein Name, den es nicht gibt, ließe nichts, wovon er ausgehen könnte. Er wird abgewiesen, statt als fehlender Einstiegspunkt gelesen zu werden.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1030
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The entrypoint `Example:start` is not a function of a module on the command line.
  Code:
    [no span available]

Dieses Modul scheitert mit H1030:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde guard Example.hiq --entrypoint=Example:start

↑ nach oben

H1031

hilde guard bekommt eine Schwachstellen-Datenbank, die es nicht lesen kann: einen Pfad, den es nicht gibt, eine Datei, die kein JSON ist, oder einen Eintrag, der nicht im OSV-Format steht.

Eine Prüfung, die ihre Datenbank nicht lesen konnte, fände nichts, und ein Bericht ohne Befund sähe aus wie ein Programm ohne Schwachstellen; deshalb wird die Datenbank vor dem Programm gelesen, und ein Fehler darin beendet das Kommando.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1031
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The vulnerability database `missing.json` cannot be read: there is no such file or directory.
  Code:
    [no span available]

Dieses Modul scheitert mit H1031:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde guard Example.hiq --vulndb=missing.json

↑ nach oben

H1032

Ein Eintrag von --library-versions ist nicht der Name einer Bibliothek, wie sie gebunden wird, ein Doppelpunkt und eine Version aus Zahlen mit Punkten dazwischen.

Die Versionen werden Zahl für Zahl mit den Bereichen der Meldungen verglichen; eine Version in anderer Form ließe sich nicht vergleichen und wird abgewiesen, statt als fehlende Version zu gelten.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1032
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `sqlite3` in --library-versions is not a library, a colon and a version of numbers separated by dots, such as `--library-versions=sqlite3:3.46.1,tls:4.3.0`.
  Code:
    [no span available]

Dieses Modul scheitert mit H1032:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde guard Example.hiq --library-versions=sqlite3

↑ nach oben

H1033

Ein Pfad für hilde fmt ist weder ein Verzeichnis, dessen Hilde-Quellen formatiert werden, noch eine Datei, deren Name auf .hih oder .hiq endet. Eine Datei anderer Art gilt nicht als Quelle.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1033
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    hilde fmt: `Example.hiq.txt` is neither a directory nor a .hih or .hiq file.
  Code:
    [no span available]

Dieses Modul scheitert mit H1033:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde fmt Example.hiq.txt

↑ nach oben

H1034

Eine Datei, die der Compiler bekam, ließ sich nicht öffnen oder lesen: Es gibt sie nicht, sie ist ein Verzeichnis, oder sie darf nicht gelesen werden. hilde check, hilde compile, hilde test und hilde fmt melden es so; vorher endete der Compiler mit einer Ausnahme von OCaml.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1034
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Failed to read file `Missing.hiq`: 
    
    Missing.hiq: No such file or directory
  Code:
    [no span available]

Dieses Modul scheitert mit H1034:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Missing.hiq --entrypoint=Example:main --target-type=c --output=example.c

↑ nach oben

H1035

Ein Wert, der mit --build-value kommt und den ein Programm mit value aus Standard.BuildInfo liest, wird name=wert geschrieben. Der Name beginnt mit einem Buchstaben und enthält Buchstaben, Ziffern, _, . und -, höchstens 64 Bytes; der Wert ist druckbares ASCII, höchstens 1024 Bytes; jeder Name kommt einmal.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1035
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The build value `1channel=stable` is refused: the name is not valid.
    
    It is written --build-value=name=value, the name a letter and then letters, digits, _, . or -, at most 64 bytes, the value printable ASCII, at most 1024 bytes, each name once.
  Code:
    [no span available]

Dieses Modul scheitert mit H1035:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main --target-type=c --output=example.c --build-value=1channel=stable

↑ nach oben

H1036

SOURCE_DATE_EPOCH gibt die Zeit des Baus, die builtAt aus Standard.BuildInfo liefert, damit zwei Bauten dieselben Bytes geben können. Ein Wert, der keine Zahl von Sekunden ist, beendet hilde compile, ob das Programm das Modul importiert oder nicht, wie es die Spezifikation der Variable verlangt.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1036
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    SOURCE_DATE_EPOCH is `17x0`, which is not a number of seconds since 1970: one to eighteen decimal digits.
  Code:
    [no span available]

Dieses Modul scheitert mit H1036:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

env SOURCE_DATE_EPOCH=17x0 hilde compile Example.hiq --entrypoint=Example:main --target-type=c --output=example.c

↑ nach oben

H1037

Das erste Wort ist kein Befehl von hilde. Bisher gab hilde seine Hilfe aus und endete mit 0, so dass ein Werkzeug, das einen Befehl aufrief, den dieser Compiler nicht hat, etwa check bei einem älteren, das für einen Erfolg hielt. Die Meldung nennt die Befehle und, für ein Wort wenige Buchstaben von einem entfernt, diesen Befehl. In diesem Katalog stehen die Befehle als der Platzhalter {...}: der Compiler nennt die, die er hat, und die Liste wechselt mit ihm.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1037
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Unknown command `chek`. The commands are build, compile, test, lsp, modules, fmt, check, query, guard, run, get, update, verify, export, new, install, doc, api-diff, rust. Did you mean `check`?
  Code:
    [no span available]

Dieses Modul scheitert mit H1037:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde chek Example.hiq

↑ nach oben

H1049

hilde test --suite nennt eine Suite, die hilde test nicht kennt. Eine Suite ist ein Test des Hilde-Baums, den sein eigenes Skript ausführt, etwa die Kohärenz-Suite, die dieselben Fälle mit mehreren Backends baut und die Ergebnisse vergleicht. Die Meldung nennt die Suiten, die es gibt.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1049
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `hilde test` knows no suite `nosuch`; the suites are coherence.
  Code:
    [no span available]

Dieses Modul scheitert mit H1049:

module body Example.Test is
    function testNothing(): Unit is
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test --suite=nosuch Example.hiq

↑ nach oben

H1050

hilde test --suite nennt eine Suite, die hier nicht laufen kann: Ihr Skript liegt nicht unter dem Arbeitsverzeichnis, oder python3 ist nicht im Pfad. Eine Suite läuft von der Wurzel des Hilde-Baums aus, wo tests/coherence/coherence.py liegt.

Meldung:

The suite `name` cannot run here: it needs `script` under the working directory, the root of the Hilde tree, and `python3` on the path.

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H2046

Eine Funktion einer Testdatei trägt den Namen eines Tests und hat eine andere Form als ein Test.

Der Name macht sie zum Test: test, gefolgt von einem Großbuchstaben oder einer Ziffer. Ein Test nimmt nichts und gibt nichts zurück, oder er nimmt die Root-Fähigkeit; eine Funktion mit dem Namen eines Tests in anderer Form wird abgelehnt statt übergangen, denn ein Test, der stillschweigend nicht läuft, sieht genauso aus wie einer, der bestanden hat.

Meldung:

FAIL  Example.hiq  the test programme did not build
hilde test: 1 test file, 0 tests, 0 failed, 1 not built
Error:
  Title: Declaration Error
  Error code: H2046
  Module:
    Example.Test
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 4, column 8
  Description:
    The function `testLength` has the name of a test, and a test has one of two forms:
    
    `function testName(): Unit`, or, for a test that needs the root capability, `generic [R: Region] function testName(root: &![RootCapability, R]): Unit`.
    
    In a test file every function whose name is test followed by a capital letter or a digit is a test.
  Code:
    1 | module body Example.Test is
    2 |     function testLength(n: Nat32): Unit is
    3 |         return nil;
    4 |     end;
    5 | end module body.

Dieses Modul scheitert mit H2046:

module body Example.Test is
    function testLength(n: Nat32): Unit is
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test Example.hiq

↑ nach oben

H2047

Eine Testdatei deklariert keine Funktion mit dem Namen eines Tests.

Meldung:

FAIL  Example.hiq  the test programme did not build
hilde test: 1 test file, 0 tests, 0 failed, 1 not built
Error:
  Title: Declaration Error
  Error code: H2047
  Module:
    Example.Test
  Location:
    [no span available]
  Description:
    The test file `Example.hiq` holds no test.
    
    A test is a function whose name is test followed by a capital letter or a digit, such as `testLength`.
  Code:
    [no span available]

Dieses Modul scheitert mit H2047:

module body Example.Test is
    function helper(): Unit is
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test Example.hiq

↑ nach oben

H2048

Ein pragma Foreign_Library nennt ein System, das der Compiler nicht kennt. Das System wird mit der Ausgabe von uname -s verglichen und deshalb so geschrieben, wie uname es schreibt, mit Großbuchstaben. Ein falsch geschriebenes System träfe nie zu, und seine Bibliothek würde nie gelinkt; deshalb wird es abgelehnt.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2048
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The system `linux` in a `pragma Foreign_Library` is not one this compiler knows.
    
    It is compared with what `uname -s` prints on the machine that compiles the programme, and must be one of `Linux, OpenBSD, FreeBSD, NetBSD, Darwin`, written as it prints them.
  Code:
    [no span available]

Dieses Modul scheitert mit H2048:

pragma Unsafe_Module;
pragma Foreign_Library(Name => "m", System => "linux");

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2049

Ein pragma Foreign_Library hat Argumente, die es nicht kennt, oder seine beiden in der anderen Reihenfolge. Es nimmt Name und danach System, wenn die Bibliothek nur auf einem System gelinkt wird.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2049
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Invalid `pragma Foreign_Library`.
    
    It takes the argument `Name`, and after it, for a library linked on one system only, `System`: `pragma Foreign_Library(Name => "crypt", System => "Linux");`
  Code:
    [no span available]

Dieses Modul scheitert mit H2049:

pragma Unsafe_Module;
pragma Foreign_Library(System => "Linux", Name => "m");

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3059

Ein literales Muster für compile aus Standard.Regex ist eines, das das Modul zur Laufzeit ablehnen würde. Ein literales Muster wird schon beim Kompilieren geprüft.

Meldung:

Error:
  Title: Type Error
  Error code: H3059
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 8
    To: line 6, column 65
  Description:
    This pattern can never compile: `Standard.Regex: lookaround is not supported -- it cannot be matched in linear time; Standard.Pcre has it at byte 1`.  Standard.Regex's compile would return that as its Left when the programme runs; a literal pattern is checked now.
  Code:
    4 | module body Example is
    5 |     function main(): ExitCode is
    6 |         let compiled: Either[String, Regex] := compile("a(?=b)");
    7 |         case compiled of
    8 |             when Right(right as re: Regex) do

Dieses Modul scheitert mit H3059:

import Standard.String (String, destroyString);
import Standard.Regex (Regex, compile, destroyRegex);

module body Example is
    function main(): ExitCode is
        let compiled: Either[String, Regex] := compile("a(?=b)");
        case compiled of
            when Right(right as re: Regex) do
                destroyRegex(re);
            when Left(left as message: String) do
                destroyString(message);
        end case;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H5001

Die Einstiegsfunktion hat mehr als einen Parameter. Sie hat keinen oder einen vom Typ RootCapability.

Meldung:

Error:
  Title: Entrypoint Definition Error
  Error code: H5001
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The entrypoint function should take a single parameter with type `RootCapability`, or none at all, but it has several.
  Code:
    [no span available]

Dieses Modul scheitert mit H5001:

module body Example is
    function main(root: RootCapability, n: Int32): ExitCode is
        surrenderRoot(root);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H5002

Das in --entrypoint genannte Modul hat keine Funktion dieses Namens.

Meldung:

Error:
  Title: Entrypoint Definition Error
  Error code: H5002
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    No function named `start` in module `Example`
  Code:
    [no span available]

Dieses Modul scheitert mit H5002:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:start --output=prog

↑ nach oben

H5003

Der in --entrypoint genannte Einstiegspunkt ist keine Funktion, etwa eine Konstante.

Meldung:

Error:
  Title: Entrypoint Definition Error
  Error code: H5003
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The entrypoint must be a function.
  Code:
    [no span available]

Dieses Modul scheitert mit H5003:

module body Example is
    constant start: Int32 := 1;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:start --output=prog

↑ nach oben

H5004

Die Einstiegsfunktion ist generisch.

Meldung:

Error:
  Title: Entrypoint Definition Error
  Error code: H5004
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The entrypoint function cannot be generic.
  Code:
    [no span available]

Dieses Modul scheitert mit H5004:

module body Example is
    generic [T: Free]
    function main(value: T): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H5005

Das Modul hat ein Interface, und das Interface deklariert die Einstiegsfunktion nicht. Sie wird dort deklariert.

Meldung:

Error:
  Title: Entrypoint Definition Error
  Error code: H5005
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The entrypoint function is not public.
    
    Consider declaring it in the module interface.
  Code:
    [no span available]

Dieses Modul scheitert mit H5005:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Example is
end module.

↑ nach oben

H5006

Der eine Parameter der Einstiegsfunktion hat nicht den Typ RootCapability.

Meldung:

Error:
  Title: Entrypoint Definition Error
  Error code: H5006
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The type of the entrypoint argument must be `RootCapability` but it is `Int32`
  Code:
    [no span available]

Dieses Modul scheitert mit H5006:

module body Example is
    function main(n: Int32): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H5007

Die Einstiegsfunktion gibt kein ExitCode zurück.

Meldung:

Error:
  Title: Entrypoint Definition Error
  Error code: H5007
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The type of the entrypoint function must be `ExitCode` but it is `Int32`
  Code:
    [no span available]

Dieses Modul scheitert mit H5007:

module body Example is
    function main(): Int32 is
        return 0;
    end;
end module body.

↑ nach oben

H6001

Der Pfad in @bytes ist leer, absolut oder enthält einen Teil ... Ein Modul darf nur eine Datei neben sich oder darunter einbetten.

Meldung:

Error:
  Title: Generic Error
  Error code: H6001
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 40
    To: line 3, column 61
  Description:
    @bytes("../data.txt"): the path leaves the module's own directory, which is not allowed
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         let data: Span[Nat8, Static] := @bytes("../data.txt");
    4 |         printLn(spanLength(data));
    5 |         return ExitSuccess();

Dieses Modul scheitert mit H6001:

module body Example is
    function main(): ExitCode is
        let data: Span[Nat8, Static] := @bytes("../data.txt");
        printLn(spanLength(data));
        return ExitSuccess();
    end;
end module body.

Daneben data.txt:

Hello

↑ nach oben

H6002

Die in @bytes genannte Datei lässt sich nicht lesen, etwa weil sie nicht neben dem Modul liegt.

Meldung:

Error:
  Title: Generic Error
  Error code: H6002
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 40
    To: line 3, column 61
  Description:
    @bytes("missing.txt"): cannot read it: ./missing.txt: No such file or directory
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         let data: Span[Nat8, Static] := @bytes("missing.txt");
    4 |         printLn(spanLength(data));
    5 |         return ExitSuccess();

Dieses Modul scheitert mit H6002:

module body Example is
    function main(): ExitCode is
        let data: Span[Nat8, Static] := @bytes("missing.txt");
        printLn(spanLength(data));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6005

Die Kommandozeile enthält ein Argument, das compile oder query nicht verwendet, etwa ein unbekanntes Flag.

Meldung:

Error:
  Title: Generic Error
  Error code: H6005
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    There are leftover arguments.
  Code:
    [no span available]

Dieses Modul scheitert mit H6005:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde compile Example.hiq --entrypoint=Example:main --output=prog --verbose

↑ nach oben

H6013

Ein Ausleihausdruck steht dort, wo keine Anweisung die Ausleihe fassen kann, etwa im Wert einer Konstanten.

Meldung:

Error:
  Title: Generic Error
  Error code: H6013
  Module:
    Example
  Location:
    [no span available]
  Description:
    Borrow expressions not allowed in this context.
  Code:
    [no span available]

Dieses Modul scheitert mit H6013:

module body Example is
    constant limit: Int32 := 5;

    constant view: &[Int32, Static] := &limit;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6020

Eine Funktion bindet denselben Namen zweimal im selben Gültigkeitsbereich, etwa mit zwei let. Hilde kennt kein Verdecken; die zweite Variable bekommt einen anderen Namen.

Meldung:

Error:
  Title: Generic Error
  Error code: H6020
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 4, column 8
    To: line 4, column 26
  Description:
    The name `n` is bound already in this function. A name stays bound until the end of the block it was bound in, also after its value is consumed, so a second binding needs a name of its own, as in `value as otherN`.
  Code:
    2 |     function main(): ExitCode is
    3 |         let n: Int32 := 1;
    4 |         let n: Int32 := 2;
    5 |         printLn(n);
    6 |         return ExitSuccess();

Dieses Modul scheitert mit H6020:

module body Example is
    function main(): ExitCode is
        let n: Int32 := 1;
        let n: Int32 := 2;
        printLn(n);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6025

Zwei verschachtelte borrow-Anweisungen geben ihren Regionen denselben Namen.

Meldung:

Error:
  Title: Generic Error
  Error code: H6025
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 12
    To: line 8, column 23
  Description:
    Region map already has a region with this name
  Code:
     4 |         let b: Int32 := 2;
     5 |         borrow ra: &[Int32, R] := &a do
     6 |             borrow rb: &[Int32, R] := &b do
     7 |                 printLn(!ra + !rb);
     8 |             end borrow;
     9 |         end borrow;
    10 |         return ExitSuccess();

Dieses Modul scheitert mit H6025:

module body Example is
    function main(): ExitCode is
        let a: Int32 := 1;
        let b: Int32 := 2;
        borrow ra: &[Int32, R] := &a do
            borrow rb: &[Int32, R] := &b do
                printLn(!ra + !rb);
            end borrow;
        end borrow;
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H6047

Eine Liste von Typparametern nennt denselben Parameter zweimal.

Meldung:

Error:
  Title: Generic Error
  Error code: H6047
  Module:
    Example
  Location:
    [no span available]
  Description:
    Duplicate type parameter `T`
  Code:
    [no span available]

Dieses Modul scheitert mit H6047:

module body Example is
    generic [T: Free, T: Free]
    function first(a: T, b: T): T is
        return a;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H9999

Ein interner Fehler: Der Compiler hat einen Zustand erreicht, den seine eigenen Prüfungen hätten ausschließen sollen. Es ist ein Fehler des Compilers, nicht des Programms. Der Weg, den dieser Eintrag zeigte, eine Einschränkung mit einer Typklasse, die nicht importiert ist, ist jetzt H3105.

Meldung:

Internal compiler error: ...

This is a bug in the compiler.

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

7. Templates

H7001

Der Name eines Templates ist leer.

Meldung:

Error:
  Title: Generic Error
  Error code: H7001
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 18, column 8
    To: line 18, column 9
  Description:
    @template: the template name is empty
  Code:
    16 |     function render(page: &[Page, R]): String is
    17 |         var out: StringBuilder := makeStringBuilder();
    18 |         @template("", page, out);
    19 |         return finalize(out);
    20 |     end;

Dieses Modul scheitert mit H7001:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title }}</p>

↑ nach oben

H7002

Der Pfad eines Templates ist absolut. Ein Template wird neben dem Modul oder darunter gelesen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7002
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 18, column 8
    To: line 18, column 9
  Description:
    @template: "/page.jinja": the path is absolute, and a template may only be read from beside the module
  Code:
    16 |     function render(page: &[Page, R]): String is
    17 |         var out: StringBuilder := makeStringBuilder();
    18 |         @template("/page.jinja", page, out);
    19 |         return finalize(out);
    20 |     end;

Dieses Modul scheitert mit H7002:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("/page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title }}</p>

↑ nach oben

H7003

Der Pfad eines Templates enthält einen Teil .. und verlässt damit das Verzeichnis des Moduls.

Meldung:

Error:
  Title: Generic Error
  Error code: H7003
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 18, column 8
    To: line 18, column 9
  Description:
    @template: "../page.jinja": the path leaves the module's own directory, which is not allowed
  Code:
    16 |     function render(page: &[Page, R]): String is
    17 |         var out: StringBuilder := makeStringBuilder();
    18 |         @template("../page.jinja", page, out);
    19 |         return finalize(out);
    20 |     end;

Dieses Modul scheitert mit H7003:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("../page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title }}</p>

↑ nach oben

H7004

Eine Template-Datei lässt sich nicht lesen, etwa weil sie nicht neben dem Modul liegt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7004
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 18, column 8
    To: line 18, column 9
  Description:
    @template: "missing.jinja": cannot read it: ./missing.jinja: No such file or directory
  Code:
    16 |     function render(page: &[Page, R]): String is
    17 |         var out: StringBuilder := makeStringBuilder();
    18 |         @template("missing.jinja", page, out);
    19 |         return finalize(out);
    20 |     end;

Dieses Modul scheitert mit H7004:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("missing.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title }}</p>

↑ nach oben

H7005

Ein Tag {{ oder {% wird geöffnet und nie geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7005
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: this tag is never closed with }}
  Code:
    [no span available]

Dieses Modul scheitert mit H7005:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title</p>

↑ nach oben

H7006

Ein Kommentar {# wird geöffnet und nie mit #} geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7006
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: this comment is never closed with #}
  Code:
    [no span available]

Dieses Modul scheitert mit H7006:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{# a note</p>

↑ nach oben

H7007

Ein {% raw %} wird nie mit {% endraw %} geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7007
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: this {% raw %} is never closed with {% endraw %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7007:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{% raw %}{{ title }}</p>

↑ nach oben

H7008

Im Tag {% endraw %} steht nach endraw noch etwas.

Meldung:

Error:
  Title: Generic Error
  Error code: H7008
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: {% endraw %} is not closed with %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7008:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{% raw %}x{% endraw now %}</p>

↑ nach oben

H7009

Eine Zahl im Template ist keine ganze Dezimalzahl, etwa 1.5.

Meldung:

Error:
  Title: Generic Error
  Error code: H7009
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: only whole decimal numbers are supported
  Code:
    [no span available]

Dieses Modul scheitert mit H7009:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ 1.5 }}</p>

↑ nach oben

H7011

Ein String in einem Tag enthält ein Escape, das das Template nicht kennt, etwa \x. Erlaubt sind nur diese sechs: \n \t \r \\ \' \"

Meldung:

Error:
  Title: Generic Error
  Error code: H7011
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: the escape \x in a string is not supported
  Code:
    [no span available]

Dieses Modul scheitert mit H7011:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ "a\x" }}</p>

↑ nach oben

H7013

In einem Tag steht ein Zeichen, das nicht zur Template-Sprache gehört.

Meldung:

Error:
  Title: Generic Error
  Error code: H7013
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: the character ; cannot stand here
  Code:
    [no span available]

Dieses Modul scheitert mit H7013:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title; }}</p>

↑ nach oben

H7014

Dem Ausdruck in einem Tag fehlt ein nötiges Symbol, etwa eine schließende Klammer.

Meldung:

Error:
  Title: Generic Error
  Error code: H7014
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: expected )
  Code:
    [no span available]

Dieses Modul scheitert mit H7014:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ (title }}</p>

↑ nach oben

H7015

In einem Tag wird ein Name erwartet, und etwas anderes steht dort, etwa nach einem Punkt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7015
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: expected a name
  Code:
    [no span available]

Dieses Modul scheitert mit H7015:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title. }}</p>

↑ nach oben

H7016

In einem Tag steht ein Operator von Jinja2, der hier keine Bedeutung hat: / teilt in einen Bruch, den ein Template hier nicht hat, und ** potenziert, was nach wenigen Schritten jeden ganzzahligen Typ verlässt. // teilt in eine ganze Zahl.

Meldung:

Error:
  Title: Generic Error
  Error code: H7016
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: the operator / divides into a fraction, and @template has no fractions; // divides into a whole number
  Code:
    [no span available]

Dieses Modul scheitert mit H7016:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ count / 2 }}</p>

↑ nach oben

H7017

Die beiden Werte eines if ... else in einer Zeile werden verschieden ausgegeben: einer ist mit |safe markiert, der andere nicht. Oder ein if in einer Zeile steht in einer Bedingung, wo and und or dasselbe sagen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7017
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: an inline if prints its two values the same way: both |safe, or neither
  Code:
    [no span available]

Dieses Modul scheitert mit H7017:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title|safe if admin else "guest" }}</p>

↑ nach oben

H7018

Der Operator in fragt einen Namen der Daten, einen String nach einem Teil oder einen Buffer nach einem Element, und er fragt nach einem Text in Anführungszeichen oder dem Namen eines Strings.

Meldung:

Error:
  Title: Generic Error
  Error code: H7018
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: `in' asks for a text in quotes or a name of a string
  Code:
    [no span available]

Dieses Modul scheitert mit H7018:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{% if 1 in items %}one{% endif %}</p>

↑ nach oben

H7019

Die Argumente eines Filters sind nicht durch Kommas getrennt oder nicht geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7019
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: expected , or )
  Code:
    [no span available]

Dieses Modul scheitert mit H7019:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title|trim(1 2) }}</p>

↑ nach oben

H7020

Ein Makro wird mit einem Schlüsselwort-Argument name=wert aufgerufen. Argumente stehen nach Position.

Meldung:

Error:
  Title: Generic Error
  Error code: H7020
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 47
    To: line 1, column 48
  Description:
    @template: keyword arguments are not supported
  Code:
    [no span available]

Dieses Modul scheitert mit H7020:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x) %}<p>{{ x }}</p>{% endmacro %}{{ show(x=title) }}

↑ nach oben

H7021

Die Argumente eines Makroaufrufs sind nicht durch Kommas getrennt oder nicht geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7021
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 57
    To: line 1, column 58
  Description:
    @template: expected , or )
  Code:
    [no span available]

Dieses Modul scheitert mit H7021:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x, y) %}<p>{{ x }}{{ y }}</p>{% endmacro %}{{ show(title title) }}

↑ nach oben

H7022

Ein Makro wird über einen Punkt aufgerufen, und der Teil vor dem Punkt ist kein Name, den ein {% import ... as %} vergeben hat, oder die Datei hat kein solches Makro. Eine Methode eines Werts kann nicht aufgerufen werden.

Meldung:

Error:
  Title: Generic Error
  Error code: H7022
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: calling title.upper: there is no such macro; the part before the dot is not a name an {% import ... as %} gave, or the file has no macro of that name
  Code:
    [no span available]

Dieses Modul scheitert mit H7022:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title.upper() }}</p>

↑ nach oben

H7023

In eckigen Klammern steht etwas anderes als ein Name in Anführungszeichen. Ein Index in eine Liste scheitert, wenn Jinja2 die Seite ausgibt und die Liste kürzer ist; ein kompiliertes Template erlaubt das nicht.

Meldung:

Error:
  Title: Generic Error
  Error code: H7023
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: [ ] takes a name in quotes, as in a["b"]: an index into a list fails when the page is rendered if the list is shorter, which a compiled template cannot allow
  Code:
    [no span available]

Dieses Modul scheitert mit H7023:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ items[0] }}</p>

↑ nach oben

H7024

Ein Minuszeichen steht vor einem Namen. Eine negative Zahl steht mit dem Minuszeichen vor ihren Ziffern; ein Name wird von null abgezogen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7024
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: a minus sign stands before a number only; write 0 - x to subtract from zero
  Code:
    [no span available]

Dieses Modul scheitert mit H7024:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ -count }}</p>

↑ nach oben

H7025

In einem Tag steht ein Symbol, wo ein Ausdruck beginnen sollte.

Meldung:

Error:
  Title: Generic Error
  Error code: H7025
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: unexpected )
  Code:
    [no span available]

Dieses Modul scheitert mit H7025:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ ) }}</p>

↑ nach oben

H7026

Ein Tag enthält keinen Ausdruck.

Meldung:

Error:
  Title: Generic Error
  Error code: H7026
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: an expression is missing
  Code:
    [no span available]

Dieses Modul scheitert mit H7026:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ }}</p>

↑ nach oben

H7027

Auf einen Ausdruck in einem Tag folgt weiterer Text.

Meldung:

Error:
  Title: Generic Error
  Error code: H7027
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: unexpected text after the expression
  Code:
    [no span available]

Dieses Modul scheitert mit H7027:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title title }}</p>

↑ nach oben

H7028

Ein {% %}-Tag beginnt nicht mit einem Schlüsselwort.

Meldung:

Error:
  Title: Generic Error
  Error code: H7028
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: a {% %} tag must begin with a keyword
  Code:
    [no span available]

Dieses Modul scheitert mit H7028:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{% = title %}</p>

↑ nach oben

H7029

Ein {% %}-Tag verwendet ein Schlüsselwort, das diese Template-Sprache nicht kennt, etwa do.

Meldung:

Error:
  Title: Generic Error
  Error code: H7029
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% do %} is not supported
  Code:
    [no span available]

Dieses Modul scheitert mit H7029:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% do title %}<p>{{ title }}</p>

↑ nach oben

H7030

Ein {% include %} oder {% extends %} nimmt den Namen des Templates und nichts danach.

Meldung:

Error:
  Title: Generic Error
  Error code: H7030
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% include %} takes the template's name and nothing after it
  Code:
    [no span available]

Dieses Modul scheitert mit H7030:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% include "part.jinja" "more" %}

Daneben part.jinja:

<p>{{ title }}</p>

↑ nach oben

H7031

Ein {% include %} oder {% extends %} bekommt einen Namen, der kein String-Literal ist. Ein erst beim Rendern gewähltes Template lässt sich nicht kompilieren.

Meldung:

Error:
  Title: Generic Error
  Error code: H7031
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% include %} takes a string literal: a template chosen when the page is rendered cannot be compiled
  Code:
    [no span available]

Dieses Modul scheitert mit H7031:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% include title %}

Daneben part.jinja:

<p>{{ title }}</p>

↑ nach oben

H7032

Einem {% import %} fehlen as und ein Name, oder es verlangt mit with context den Kontext des Templates. Ein importiertes Makro sieht die Daten des Templates nicht.

Meldung:

Error:
  Title: Generic Error
  Error code: H7032
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% import %} takes a string literal, `as' and a name: {% import "file" as name %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7032:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% import "macros.jinja" %}<p>{{ title }}</p>

Daneben macros.jinja:

{% macro show(text) %}<b>{{ text }}</b>{% endmacro %}

↑ nach oben

H7033

Ein Template verwendet {% autoescape %}. Das Maskieren lässt sich nicht abschnittsweise abschalten; der eine Wert, der unmaskiert hinaus soll, bekommt |safe.

Meldung:

Error:
  Title: Generic Error
  Error code: H7033
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% autoescape %} is refused: escaping cannot be switched off for a stretch of template -- write |safe on the one value that is meant to go out unescaped, where a grep finds it
  Code:
    [no span available]

Dieses Modul scheitert mit H7033:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% autoescape false %}<p>{{ title }}</p>{% endautoescape %}

↑ nach oben

H7034

Ein schließender oder fortsetzender Tag wie {% endif %} oder {% else %} steht ohne seinen öffnenden Tag.

Meldung:

Error:
  Title: Generic Error
  Error code: H7034
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 18
    To: line 1, column 19
  Description:
    @template: {% endif %} without the tag it belongs to
  Code:
    [no span available]

Dieses Modul scheitert mit H7034:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title }}</p>{% endif %}

↑ nach oben

H7035

Auf ein {% else %} eines {% if %} folgt kein {% endif %}.

Meldung:

Error:
  Title: Generic Error
  Error code: H7035
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 26
    To: line 1, column 27
  Description:
    @template: {% else %} without {% endif %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7035:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if admin %}<p>admin</p>{% else %}<p>guest</p>

↑ nach oben

H7036

Ein {% if %} wird nie mit {% endif %} geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7036
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% if %} without {% endif %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7036:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if admin %}<p>admin</p>

↑ nach oben

H7037

Ein {% for %} nennt mehr als drei Namen. Ein Name nimmt das Element; zwei oder drei entpacken ein Pair oder ein Triple aus Standard.Tuples.

Meldung:

Error:
  Title: Generic Error
  Error code: H7037
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% for %} takes one name, or two or three that unpack a Pair or a Triple of Standard.Tuples
  Code:
    [no span available]

Dieses Modul scheitert mit H7037:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for a, b, c, d in items %}{{ a }}{% endfor %}

↑ nach oben

H7038

Einem {% for %} fehlt das Wort in.

Meldung:

Error:
  Title: Generic Error
  Error code: H7038
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: expected `in' in {% for %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7038:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for item of items %}{{ item }}{% endfor %}

↑ nach oben

H7039

Nach der Folge eines {% for %} steht etwas anderes als if und eine Bedingung, etwa recursive.

Meldung:

Error:
  Title: Generic Error
  Error code: H7039
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: after {% for ... in ... %} only `if' and a condition may follow
  Code:
    [no span available]

Dieses Modul scheitert mit H7039:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for item in items recursive %}{{ item }}{% endfor %}

↑ nach oben

H7040

Auf ein {% else %} eines {% for %} folgt kein {% endfor %}.

Meldung:

Error:
  Title: Generic Error
  Error code: H7040
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 33
    To: line 1, column 34
  Description:
    @template: {% else %} without {% endfor %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7040:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for item in items %}{{ item }}{% else %}<p>none</p>

↑ nach oben

H7041

Ein {% for %} wird nie mit {% endfor %} geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7041
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% for %} without {% endfor %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7041:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for item in items %}{{ item }}

↑ nach oben

H7042

Ein Block ist als required markiert.

Meldung:

Error:
  Title: Generic Error
  Error code: H7042
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: a `required' block is not supported
  Code:
    [no span available]

Dieses Modul scheitert mit H7042:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% block main required %}<p>{{ title }}</p>{% endblock %}

↑ nach oben

H7043

Ein {% block %} hat keinen Namen oder danach etwas anderes als scoped.

Meldung:

Error:
  Title: Generic Error
  Error code: H7043
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% block %} takes a name, and `scoped' after it
  Code:
    [no span available]

Dieses Modul scheitert mit H7043:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% block %}<p>{{ title }}</p>{% endblock %}

↑ nach oben

H7044

Ein {% block %} wird nie mit {% endblock %} geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7044
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% block main %} without {% endblock %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7044:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% block main %}<p>{{ title }}</p>

↑ nach oben

H7045

Ein {% endblock %} nennt einen anderen Block als den, den es schließt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7045
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 34
    To: line 1, column 35
  Description:
    @template: {% endblock side %} closes {% block main %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7045:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% block main %}<p>{{ title }}</p>{% endblock side %}

↑ nach oben

H7046

Der Vorgabewert eines Makroparameters ist kein Literal.

Meldung:

Error:
  Title: Generic Error
  Error code: H7046
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: a macro parameter's default is a literal
  Code:
    [no span available]

Dieses Modul scheitert mit H7046:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x=title) %}{{ x }}{% endmacro %}<p>{{ show() }}</p>

↑ nach oben

H7047

Die Parameter eines Makros sind nicht durch Kommas getrennt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7047
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: expected , or ) in the macro's parameters
  Code:
    [no span available]

Dieses Modul scheitert mit H7047:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x y) %}{{ x }}{% endmacro %}<p>{{ show(title, title) }}</p>

↑ nach oben

H7048

Auf die Parameterliste eines Makros folgt weiterer Text.

Meldung:

Error:
  Title: Generic Error
  Error code: H7048
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: unexpected text after the macro's parameters
  Code:
    [no span available]

Dieses Modul scheitert mit H7048:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x) now %}{{ x }}{% endmacro %}<p>{{ show(title) }}</p>

↑ nach oben

H7049

Ein {% macro %} wird nie mit {% endmacro %} geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7049
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% macro show %} without {% endmacro %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7049:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x) %}{{ x }}

↑ nach oben

H7050

Ein {% from ... import %} gibt einem importierten Makro mit as einen anderen Namen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7050
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: `as' in {% from ... import %} is not supported
  Code:
    [no span available]

Dieses Modul scheitert mit H7050:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% from "macros.jinja" import show as display %}<p>{{ display(title) }}</p>

Daneben macros.jinja:

{% macro show(x) %}{{ x }}{% endmacro %}

↑ nach oben

H7051

Ein {% from ... import %} nennt etwas anderes als Makros.

Meldung:

Error:
  Title: Generic Error
  Error code: H7051
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% from "file" import a, b %} names the macros to import, and nothing else
  Code:
    [no span available]

Dieses Modul scheitert mit H7051:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% from "macros.jinja" import 1 %}<p>{{ title }}</p>

Daneben macros.jinja:

{% macro show(x) %}{{ x }}{% endmacro %}

↑ nach oben

H7052

Einem {% from %} fehlt der Dateiname als String oder das Wort import.

Meldung:

Error:
  Title: Generic Error
  Error code: H7052
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% from %} takes a string literal and `import'
  Code:
    [no span available]

Dieses Modul scheitert mit H7052:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% from macros import show %}<p>{{ show(title) }}</p>

Daneben macros.jinja:

{% macro show(x) %}{{ x }}{% endmacro %}

↑ nach oben

H7054

Ein Makro wird zweimal mit zwei Rümpfen definiert.

Meldung:

Error:
  Title: Generic Error
  Error code: H7054
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 40
    To: line 1, column 41
  Description:
    @template: the macro show is defined twice
  Code:
    [no span available]

Dieses Modul scheitert mit H7054:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x) %}{{ x }}{% endmacro %}{% macro show(x) %}<b>{{ x }}</b>{% endmacro %}<p>{{ show(title) }}</p>

↑ nach oben

H7055

Ein Template importiert Makros aus sich selbst.

Meldung:

Error:
  Title: Generic Error
  Error code: H7055
  Module:
    Example
  Location:
    Filename: './macros.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: "macros.jinja" imports from itself
  Code:
    [no span available]

Dieses Modul scheitert mit H7055:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% from "macros.jinja" import show %}<p>{{ show(title) }}</p>

Daneben macros.jinja:

{% from "macros.jinja" import show %}{% macro show(x) %}{{ x }}{% endmacro %}

↑ nach oben

H7056

Ein {% from ... import %} nennt ein Makro, das die Datei nicht definiert.

Meldung:

Error:
  Title: Generic Error
  Error code: H7056
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: "macros.jinja" has no macro display
  Code:
    [no span available]

Dieses Modul scheitert mit H7056:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% from "macros.jinja" import display %}<p>{{ title }}</p>

Daneben macros.jinja:

{% macro show(x) %}{{ x }}{% endmacro %}

↑ nach oben

H7057

Ein Template bindet sich selbst ein oder erweitert sich selbst, direkt oder über andere.

Meldung:

Error:
  Title: Generic Error
  Error code: H7057
  Module:
    Example
  Location:
    Filename: './part.jinja'
    From: line 1, column 18
    To: line 1, column 19
  Description:
    @template: "page.jinja" includes or extends itself: page.jinja -> part.jinja -> page.jinja
  Code:
    [no span available]

Dieses Modul scheitert mit H7057:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% include "part.jinja" %}

Daneben part.jinja:

<p>{{ title }}</p>{% include "page.jinja" %}

↑ nach oben

H7058

Ein Template erweitert ein zweites Mal.

Meldung:

Error:
  Title: Generic Error
  Error code: H7058
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 26
    To: line 1, column 27
  Description:
    @template: a template extends one other template, once
  Code:
    [no span available]

Dieses Modul scheitert mit H7058:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% extends "base.jinja" %}{% extends "base.jinja" %}{% block main %}{{ title }}{% endblock %}

Daneben base.jinja:

<html>{% block main %}{% endblock %}</html>

↑ nach oben

H7059

Nach {% extends %} steht Text außerhalb eines Blocks. Jinja2 würde ihn verwerfen; hier wird er abgelehnt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7059
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 26
    To: line 1, column 27
  Description:
    @template: text after {% extends %} and outside a block is dropped by Jinja2; here it is refused
  Code:
    [no span available]

Dieses Modul scheitert mit H7059:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% extends "base.jinja" %}lost text{% block main %}{{ title }}{% endblock %}

Daneben base.jinja:

<html>{% block main %}{% endblock %}</html>

↑ nach oben

H7060

Nach {% extends %} steht ein Wert außerhalb eines Blocks.

Meldung:

Error:
  Title: Generic Error
  Error code: H7060
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 26
    To: line 1, column 27
  Description:
    @template: a value after {% extends %} and outside a block is dropped by Jinja2; here it is refused
  Code:
    [no span available]

Dieses Modul scheitert mit H7060:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% extends "base.jinja" %}{{ title }}{% block main %}{{ title }}{% endblock %}

Daneben base.jinja:

<html>{% block main %}{% endblock %}</html>

↑ nach oben

H7061

Nach {% extends %} steht ein {% if %} oder {% for %} außerhalb eines Blocks.

Meldung:

Error:
  Title: Generic Error
  Error code: H7061
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: an if or a for after {% extends %} and outside a block is dropped by Jinja2; here it is refused
  Code:
    [no span available]

Dieses Modul scheitert mit H7061:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% extends "base.jinja" %}{% if admin %}{% endif %}{% block main %}{{ title }}{% endblock %}

Daneben base.jinja:

<html>{% block main %}{% endblock %}</html>

↑ nach oben

H7062

Nach {% extends %} steht ein {% include %} außerhalb eines Blocks.

Meldung:

Error:
  Title: Generic Error
  Error code: H7062
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 26
    To: line 1, column 27
  Description:
    @template: an include after {% extends %} and outside a block is dropped by Jinja2; here it is refused
  Code:
    [no span available]

Dieses Modul scheitert mit H7062:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% extends "base.jinja" %}{% include "part.jinja" %}{% block main %}{{ title }}{% endblock %}

Daneben base.jinja:

<html>{% block main %}{% endblock %}</html>

Daneben part.jinja:

<p>{{ title }}</p>

↑ nach oben

H7063

super() steht in einem Block, den kein Template darüber hat.

Meldung:

Error:
  Title: Generic Error
  Error code: H7063
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 16
    To: line 1, column 17
  Description:
    @template: super() in a block that no template above this one has
  Code:
    [no span available]

Dieses Modul scheitert mit H7063:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% block main %}{{ super() }}<p>{{ title }}</p>{% endblock %}

↑ nach oben

H7064

super() bekommt Argumente.

Meldung:

Error:
  Title: Generic Error
  Error code: H7064
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 42
    To: line 1, column 43
  Description:
    @template: super() takes no arguments
  Code:
    [no span available]

Dieses Modul scheitert mit H7064:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% extends "base.jinja" %}{% block main %}{{ super(1) }}{{ title }}{% endblock %}

Daneben base.jinja:

<html>{% block main %}{% endblock %}</html>

↑ nach oben

H7065

Ein {% extends %} steht in einem anderen Tag, etwa einem {% if %}. Es steht auf oberster Ebene, einmal.

Meldung:

Error:
  Title: Generic Error
  Error code: H7065
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 14
    To: line 1, column 15
  Description:
    @template: {% extends %} stands at the top level of a template, once
  Code:
    [no span available]

Dieses Modul scheitert mit H7065:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if admin %}{% extends "base.jinja" %}{% endif %}<p>{{ title }}</p>

Daneben base.jinja:

<html>{% block main %}{% endblock %}</html>

↑ nach oben

H7066

Ein Template definiert einen Block, den kein erweitertes Template hat. Jinja2 würde ihn verwerfen; hier wird er abgelehnt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7066
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 26
    To: line 1, column 27
  Description:
    @template: the block side is defined here, and no template this one extends has a block of that name; Jinja2 drops it without a word, and here it is refused
  Code:
    [no span available]

Dieses Modul scheitert mit H7066:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% extends "base.jinja" %}{% block side %}{{ title }}{% endblock %}

Daneben base.jinja:

<html>{% block main %}{% endblock %}</html>

↑ nach oben

H7067

Ein Wert steht an einer Stelle des HTML, an der ihn kein Maskieren sicher macht, etwa im Namen eines Tags oder in seiner Attributliste.

Meldung:

Error:
  Title: Generic Error
  Error code: H7067
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 5
    To: line 1, column 6
  Description:
    @template: a value cannot stand in a tag, between its attributes: there is no escaping that makes that safe
  Code:
    [no span available]

Dieses Modul scheitert mit H7067:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<div {{ title }}>x</div>

↑ nach oben

H7069

loop wird für etwas anderes als loop.index, loop.index0, loop.length, loop.first oder loop.last verwendet.

Meldung:

Error:
  Title: Generic Error
  Error code: H7069
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 23
    To: line 1, column 24
  Description:
    @template: `loop' can only be asked for loop.index, loop.index0, loop.revindex, loop.revindex0, loop.length, loop.first, loop.last and loop.cycle(...), inside a {% for %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7069:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for item in items %}{{ loop }}{% endfor %}

↑ nach oben

H7070

Ein mit {% from ... import %} geholtes Makro verwendet die Daten des Templates. Ein solches Makro sieht nur seine Argumente.

Meldung:

Error:
  Title: Generic Error
  Error code: H7070
  Module:
    Example
  Location:
    Filename: './macros.jinja'
    From: line 1, column 18
    To: line 1, column 19
  Description:
    @template: title: a macro brought in with {% from ... import %} or {% import %} does not see the template's data, as in Jinja2 -- pass it as an argument
  Code:
    [no span available]

Dieses Modul scheitert mit H7070:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% from "macros.jinja" import show %}<p>{{ show() }}</p>

Daneben macros.jinja:

{% macro show() %}{{ title }}{% endmacro %}

↑ nach oben

H7071

loop wird außerhalb eines {% for %} verwendet.

Meldung:

Error:
  Title: Generic Error
  Error code: H7071
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: `loop' only exists inside a {% for %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7071:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ loop.index }}</p>

↑ nach oben

H7072

Eine in einer Bedingung verglichene Zahl ist zu groß.

Meldung:

Error:
  Title: Generic Error
  Error code: H7072
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: this number is too large
  Code:
    [no span available]

Dieses Modul scheitert mit H7072:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if count > 99999999999999999999 %}many{% endif %}

↑ nach oben

H7073

Ein Schleifenattribut wird ausgegeben, das sich nicht ausgeben lässt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7073
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 23
    To: line 1, column 24
  Description:
    @template: loop.cycle cannot be printed
  Code:
    [no span available]

Dieses Modul scheitert mit H7073:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for item in items %}{{ loop.cycle }}{% endfor %}

↑ nach oben

H7075

|length wird auf etwas angewandt, das kein Name der Daten ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H7075
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: |length is supported on a name of the data only
  Code:
    [no span available]

Dieses Modul scheitert mit H7075:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ "abc"|length }}</p>

↑ nach oben

H7076

Es wird ein Filter verwendet, den diese Template-Sprache nicht kennt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7076
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: the filter |wordcount is not supported
  Code:
    [no span available]

Dieses Modul scheitert mit H7076:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title|wordcount }}</p>

↑ nach oben

H7077

none wird ausgegeben. Ein Option wird ausgegeben, nachdem mit is not none gefragt wurde.

Meldung:

Error:
  Title: Generic Error
  Error code: H7077
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: none cannot be printed: an Option is printed by asking `is not none' first
  Code:
    [no span available]

Dieses Modul scheitert mit H7077:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ none }}</p>

↑ nach oben

H7079

Ein Makroaufruf steht mit einem Filter in {{ }}. Ein Makroaufruf steht allein.

Meldung:

Error:
  Title: Generic Error
  Error code: H7079
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 43
    To: line 1, column 44
  Description:
    @template: a macro call stands alone in {{ }}, without filters
  Code:
    [no span available]

Dieses Modul scheitert mit H7079:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x) %}{{ x }}{% endmacro %}<p>{{ show(title)|upper }}</p>

↑ nach oben

H7080

Ein Attribut von loop, das keine Zahl ist, steht, wo eine Zahl hingehört, in einem Vergleich oder in einer Rechnung. loop.first und loop.last sind Bedingungen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7080
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 23
    To: line 1, column 24
  Description:
    @template: loop.first is not a number
  Code:
    [no span available]

Dieses Modul scheitert mit H7080:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for item in items %}{% if loop.first > 0 %}{{ item }}{% endif %}{% endfor %}

↑ nach oben

H7082

Eine Bedingung fragt is defined. Das Template wird gegen einen Datentyp kompiliert; jeder Name ist also beim Kompilieren bekannt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7082
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: `is defined' cannot be asked: the template is compiled against one data type, so every name is known when the programme is compiled, and a name that does not exist is a compile error already
  Code:
    [no span available]

Dieses Modul scheitert mit H7082:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if title is defined %}<p>{{ title }}</p>{% endif %}

↑ nach oben

H7083

is none wird von etwas gefragt, das kein Name der Daten ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H7083
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: `is none' is supported on a name of the data only
  Code:
    [no span available]

Dieses Modul scheitert mit H7083:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if "x" is none %}<p>none</p>{% endif %}

↑ nach oben

H7084

Eine Bedingung verwendet einen Test, den diese Template-Sprache nicht kennt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7084
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: the test `is even' is not supported
  Code:
    [no span available]

Dieses Modul scheitert mit H7084:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if count is even %}<p>even</p>{% endif %}

↑ nach oben

H7085

Ein String wird mit einem anderen Operator als == und != verglichen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7085
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: a string can only be compared with == and !=
  Code:
    [no span available]

Dieses Modul scheitert mit H7085:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if title < "m" %}<p>early</p>{% endif %}

↑ nach oben

H7086

Ein Vergleich vergleicht nicht einen Namen mit einem Literal.

Meldung:

Error:
  Title: Generic Error
  Error code: H7086
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: only a name compared with a literal, or with a computed number, is supported
  Code:
    [no span available]

Dieses Modul scheitert mit H7086:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if count > count %}<p>more</p>{% endif %}

↑ nach oben

H7087

Etwas, das keine Bedingung ist, steht als Bedingung, etwa ein String.

Meldung:

Error:
  Title: Generic Error
  Error code: H7087
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: this cannot be used as a condition
  Code:
    [no span available]

Dieses Modul scheitert mit H7087:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if "yes" %}<p>yes</p>{% endif %}

↑ nach oben

H7088

Ein Makroparameter, der ein Literal bekommt, wird mit einem Feld verwendet, wie in x.name.

Meldung:

Error:
  Title: Generic Error
  Error code: H7088
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 19
    To: line 1, column 20
  Description:
    @template: the parameter x is a literal here, and a literal has no fields
  Code:
    [no span available]

Dieses Modul scheitert mit H7088:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x) %}{{ x.name }}{% endmacro %}<p>{{ show("a") }}</p>

↑ nach oben

H7089

Ein Makro wird aufgerufen, das nicht definiert ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H7089
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: there is no macro show
  Code:
    [no span available]

Dieses Modul scheitert mit H7089:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ show(title) }}</p>

↑ nach oben

H7090

Ein Makro ruft sich selbst auf. Ein Template wird beim Kompilieren ausgeklappt, und eine Rekursion würde nicht enden.

Meldung:

Error:
  Title: Generic Error
  Error code: H7090
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 19
    To: line 1, column 20
  Description:
    @template: the macro show calls itself: show -> show; a template is expanded when the programme is compiled, and a recursion would not end
  Code:
    [no span available]

Dieses Modul scheitert mit H7090:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x) %}{{ show(x) }}{% endmacro %}<p>{{ show(title) }}</p>

↑ nach oben

H7091

Ein Makro wird mit mehr Argumenten aufgerufen, als es Parameter hat.

Meldung:

Error:
  Title: Generic Error
  Error code: H7091
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 43
    To: line 1, column 44
  Description:
    @template: the macro show takes 1 arguments
  Code:
    [no span available]

Dieses Modul scheitert mit H7091:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x) %}{{ x }}{% endmacro %}<p>{{ show(title, title) }}</p>

↑ nach oben

H7092

Ein Makro wird ohne Wert für einen Parameter ohne Vorgabewert aufgerufen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7092
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 43
    To: line 1, column 44
  Description:
    @template: the macro show needs a value for x
  Code:
    [no span available]

Dieses Modul scheitert mit H7092:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x) %}{{ x }}{% endmacro %}<p>{{ show() }}</p>

↑ nach oben

H7093

Ein Makroargument ist weder ein Name noch ein Literal.

Meldung:

Error:
  Title: Generic Error
  Error code: H7093
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 43
    To: line 1, column 44
  Description:
    @template: a macro argument is a name or a literal
  Code:
    [no span available]

Dieses Modul scheitert mit H7093:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro show(x) %}{{ x }}{% endmacro %}<p>{{ show(title|upper) }}</p>

↑ nach oben

H7095

Die Zweige eines {% if %} enden an verschiedenen Stellen des HTML, etwa einer in einem Script und einer außerhalb.

Meldung:

Error:
  Title: Generic Error
  Error code: H7095
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: the branches of this {% if %} end in different places in the HTML: a <script> element and HTML text
  Code:
    [no span available]

Dieses Modul scheitert mit H7095:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if admin %}<script>{% endif %}<p>{{ title }}</p>

↑ nach oben

H7096

Ein {% for %} läuft über etwas, das kein Name der Daten ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H7096
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% for %} walks over a name of the data only
  Code:
    [no span available]

Dieses Modul scheitert mit H7096:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for c in "abc" %}{{ c }}{% endfor %}

↑ nach oben

H7097

Der Rumpf eines {% for %} endet an einer anderen Stelle des HTML, als er beginnt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7097
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: the body of this {% for %} ends in a different place in the HTML than it begins: HTML text and a <script> element
  Code:
    [no span available]

Dieses Modul scheitert mit H7097:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for item in items %}<script>{% endfor %}

↑ nach oben

H7098

Das {% else %} eines {% for %} endet an einer anderen Stelle des HTML, als es beginnt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7098
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: the {% else %} of this {% for %} ends in a different place in the HTML than it begins
  Code:
    [no span available]

Dieses Modul scheitert mit H7098:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% for item in items %}{{ item }}{% else %}<script>{% endfor %}

↑ nach oben

H7099

Ein Modul, das @template verwendet, importiert Standard.Template nicht. Der erzeugte Code ruft es auf, und seine Instanzen kommen mit dem Import.

Meldung:

Error:
  Title: Generic Error
  Error code: H7099
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 17, column 8
    To: line 17, column 9
  Description:
    @template: a module that uses @template imports Standard.Template -- e.g. `import Standard.Template (Render);' -- because the generated code calls it, and its instances come with the import
  Code:
    15 |     function render(page: &[Page, R]): String is
    16 |         var out: StringBuilder := makeStringBuilder();
    17 |         @template("page.jinja", page, out);
    18 |         return finalize(out);
    19 |     end;

Dieses Modul scheitert mit H7099:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title }}</p>

↑ nach oben

H7100

Ein {% set %}-Block, ein {% with %}, ein {% filter %} oder ein {% call %} wird nicht mit seinem End-Tag geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7100
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% with %} without {% endwith %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7100:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% with name = title %}<p>{{ name }}</p>

↑ nach oben

H7101

Das Tag eines {% set %}, {% with %}, {% filter %} oder {% call %} hat nicht seine Form: set nimmt einen Namen, = und einen Wert; with nimmt Namen mit = und Werten, durch Kommas getrennt; filter nimmt Filter, durch | getrennt; call nimmt einen Makroaufruf, und caller() nimmt keine Parameter.

Meldung:

Error:
  Title: Generic Error
  Error code: H7101
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% set %} takes one name, = and one value
  Code:
    [no span available]

Dieses Modul scheitert mit H7101:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% set a b = title %}<p>{{ a }}</p>

↑ nach oben

H7102

Der Name, den ein {% import ... as %} vergeben hat, wird ausgegeben oder zwei Imports gegeben. Er steht für die Makros einer Datei und verdeckt ein gleichnamiges Feld der Daten, wie in Jinja2.

Meldung:

Error:
  Title: Generic Error
  Error code: H7102
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 37
    To: line 1, column 38
  Description:
    @template: the name lib is an import's: it stands for the macros of a file, and a macro is called, not printed
  Code:
    [no span available]

Dieses Modul scheitert mit H7102:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% import "macros.jinja" as lib %}<p>{{ lib }}</p>

Daneben macros.jinja:

{% macro show(text) %}<b>{{ text }}</b>{% endmacro %}

↑ nach oben

H7103

Ein {% set %} steht nach {% extends %} und außerhalb jedes Blocks. Ob ein Block der Elternvorlage den Namen sieht, hängt von der Reihenfolge ab, in der Jinja2 die beiden Templates ausführt; er gehört in den Block.

Meldung:

Error:
  Title: Generic Error
  Error code: H7103
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 26
    To: line 1, column 27
  Description:
    @template: a {% set %} after {% extends %} and outside a block is refused: whether a block sees it depends on the order in which Jinja2 runs the two templates
  Code:
    [no span available]

Dieses Modul scheitert mit H7103:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% extends "base.jinja" %}{% set name = title %}{% block main %}{{ name }}{% endblock %}

Daneben base.jinja:

<main>{% block main %}{% endblock %}</main>

↑ nach oben

H7104

Ein Name, den ein {% set %} oder ein {% with %} an einen berechneten Wert gebunden hat, etwa einen mit ~ verbundenen Text, wird nach einem Feld gefragt. Nur ein Name der Daten hat Felder.

Meldung:

Error:
  Title: Generic Error
  Error code: H7104
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 31
    To: line 1, column 32
  Description:
    @template: name is a value that a {% set %} or a {% with %} computed, and a computed value has no fields
  Code:
    [no span available]

Dieses Modul scheitert mit H7104:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% set name = title ~ "!" %}<p>{{ name.length }}</p>

↑ nach oben

H7105

// oder % teilt durch einen Namen der Daten oder durch null. Ein Teiler aus den Daten könnte null sein, und eine Division durch null hält das Programm an; der Teiler ist eine im Template geschriebene Zahl.

Meldung:

Error:
  Title: Generic Error
  Error code: H7105
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: // divides by a number written in the template only: a divisor from the data could be zero, and a division by zero stops the programme
  Code:
    [no span available]

Dieses Modul scheitert mit H7105:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ count // count }}</p>

↑ nach oben

H7106

Ein Operand von + - * // % ist etwas anderes als eine Zahl: ein Text, ein Filter oder eine Bedingung.

Meldung:

Error:
  Title: Generic Error
  Error code: H7106
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: this is not a number: + - * // % take numbers, names of the data and the numbers of loop
  Code:
    [no span available]

Dieses Modul scheitert mit H7106:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ count + "1" }}</p>

↑ nach oben

H7107

Der Operator ~ verbindet einen mit |safe markierten Wert oder den Text eines {% set %}-Blocks mit einem Text, der bei der Ausgabe maskiert wird. Das Ergebnis wäre halb maskiert; der Wert mit |safe wird für sich ausgegeben.

Meldung:

Error:
  Title: Generic Error
  Error code: H7107
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: ~ joins texts that are escaped when printed; a |safe value or a {% set %} block's text cannot be joined to them -- print it on its own
  Code:
    [no span available]

Dieses Modul scheitert mit H7107:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title|safe ~ "!" }}</p>

↑ nach oben

H7108

Die Argumente von |replace, |truncate, |center, |join oder loop.cycle sind keine Literale der Art, die der Filter nimmt, oder nicht in ihrem Bereich: die Länge von |truncate ist mindestens die Länge ihres Endes.

Meldung:

Error:
  Title: Generic Error
  Error code: H7108
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: |truncate takes a length at least as long as its ending, and a leeway of at least 0
  Code:
    [no span available]

Dieses Modul scheitert mit H7108:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title|truncate(2) }}</p>

↑ nach oben

H7109

Ein {% filter %}-Block nennt einen Filter, der auf einen Wert wirkt, etwa |join oder |length, nicht auf den Text, den der Block schreibt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7109
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: the filter |join cannot stand in {% filter %}: it applies to a value, not to written text
  Code:
    [no span available]

Dieses Modul scheitert mit H7109:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% filter join %}<p>{{ title }}</p>{% endfilter %}

↑ nach oben

H7110

Ein {% set %} steht in einem {% if %}. In Jinja2 ist der Name nach dem {% endif %} noch da, wenn der Zweig lief, und fehlt, wenn nicht; ein kompiliertes Template kann dem nicht folgen. Der Name gehört vor das {% if %}, oder es steht ein {% with %}.

Meldung:

Error:
  Title: Generic Error
  Error code: H7110
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 14
    To: line 1, column 15
  Description:
    @template: {% set name %} inside an {% if %} is refused: in Jinja2 the name is still there after the {% endif %} when the branch ran, and missing when it did not, which a compiled template cannot follow; set it before the {% if %}, or use {% with %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7110:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% if admin %}{% set name = title %}{% endif %}<p>{{ title }}</p>

↑ nach oben

H7111

Ein {% filter %}-Block steht an einer anderen Stelle als im HTML-Text, oder der Text eines {% set %}- oder {% filter %}-Blocks endet an einer anderen Stelle, als er begann. Was ein solcher Block schreibt, wird als HTML-Text maskiert.

Meldung:

Error:
  Title: Generic Error
  Error code: H7111
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 10
    To: line 1, column 11
  Description:
    @template: a {% set %} or {% filter %} block stands in HTML text and ends there; this one stands in the value of the attribute title
  Code:
    [no span available]

Dieses Modul scheitert mit H7111:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<a title="{% filter upper %}{{ title }}{% endfilter %}">x</a>

↑ nach oben

H7112

caller() steht in einem Makro, das ohne {% call %}-Block aufgerufen wird, oder bekommt Argumente. Jinja2 scheitert, wenn es einen solchen Aufruf ausgibt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7112
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 22
    To: line 1, column 23
  Description:
    @template: caller() stands in a macro that a {% call %} block calls
  Code:
    [no span available]

Dieses Modul scheitert mit H7112:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% macro box() %}<div>{{ caller() }}</div>{% endmacro %}<p>{{ box() }}</p>

↑ nach oben

H7113

Der Text, den ein {% set %}-Block geschrieben hat, wird an einer anderen Stelle als im HTML-Text ausgegeben, etwa in einem Attribut. Er ist HTML, bereits maskiert, und wird ausgegeben, wie er steht.

Meldung:

Error:
  Title: Generic Error
  Error code: H7113
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 54
    To: line 1, column 55
  Description:
    @template: the text of a {% set %} block is HTML, escaped already, and is printed in HTML text only, not in the value of the attribute title
  Code:
    [no span available]

Dieses Modul scheitert mit H7113:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% set cell %}<b>{{ title }}</b>{% endset %}<a title="{{ cell }}">x</a>

↑ nach oben

H7114

Das vierte Argument von @template nennt eine andere Option als trim_blocks und lstrip_blocks.

Meldung:

Error:
  Title: Generic Error
  Error code: H7114
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 18, column 8
    To: line 18, column 9
  Description:
    @template: "strict": @template knows the options trim_blocks and lstrip_blocks
  Code:
    16 |     function render(page: &[Page, R]): String is
    17 |         var out: StringBuilder := makeStringBuilder();
    18 |         @template("page.jinja", page, out, "strict");
    19 |         return finalize(out);
    20 |     end;

Dieses Modul scheitert mit H7114:

import Standard.Buffer (Buffer);
import Standard.String (String);
import Standard.StringBuilder (StringBuilder, makeStringBuilder, finalize);
import Standard.Template (Render);

module body Example is
    record Page: Linear is
        title: String;
        motto: Option[String];
        items: Buffer[Index];
        admin: Bool;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out, "strict");
        return finalize(out);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ title }}</p>

↑ nach oben

H7115

Das erste Argument von _( ) ist der Schlüssel, geschrieben als String-Literal: der Name eines Falls der Schlüssel des Katalogs. Ein Name der Daten oder ein Ausdruck an seiner Stelle wäre ein Schlüssel, der erst beim Rendern feststeht, und den kann der Compiler nicht prüfen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7115
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 25
    To: line 1, column 26
  Description:
    @template: _( ) takes the key first, as a string literal, as in _("Greeting")
  Code:
    [no span available]

Dieses Modul scheitert mit H7115:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}<p>{{ _(user) }}</p>

↑ nach oben

H7116

Jedes Argument von _( ) hat einen eigenen Namen; derselbe Name zweimal ließe offen, welchen Wert der Platzhalter bekommt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7116
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 25
    To: line 1, column 26
  Description:
    @template: _( ) is given name twice
  Code:
    [no span available]

Dieses Modul scheitert mit H7116:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}<p>{{ _("Greeting", name=user, name=user) }}</p>

↑ nach oben

H7117

{% catalog %} nimmt den Namen einer Funktion ohne Argumente, die den Katalog liefert, ohne Anführungszeichen; das Modul mit dem @template hat die Funktion oder importiert sie.

Meldung:

Error:
  Title: Generic Error
  Error code: H7117
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: {% catalog %} takes the name of a function of no arguments that gives the catalog, as in {% catalog messages %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7117:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog "messages" %}<p>{{ _("Greeting", name=user) }}</p>

↑ nach oben

H7118

Der Text zwischen {% trans %} und {% pluralize %} oder {% endtrans %} ist der Schlüssel, ein Name wie Greeting. Die Texte der Sprachen stehen im Katalog, nicht im Template.

Meldung:

Error:
  Title: Generic Error
  Error code: H7118
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 25
    To: line 1, column 26
  Description:
    @template: the text of a {% trans %} block is its key, one name such as Greeting; the texts of the languages stand in the catalog
  Code:
    [no span available]

Dieses Modul scheitert mit H7118:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}<p>{% trans name=user %}Hello, {{ name }}!{% endtrans %}</p>

↑ nach oben

H7119

Die Anzahl wählt die Pluralform, also nennt ein {% trans %}-Block mit {% pluralize %} sie: count=... in seinem Tag.

Meldung:

Error:
  Title: Generic Error
  Error code: H7119
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 41
    To: line 1, column 42
  Description:
    @template: {% pluralize %} needs count=... in its {% trans %}: the count chooses the form
  Code:
    [no span available]

Dieses Modul scheitert mit H7119:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}<p>{% trans %}Items{% pluralize %}{% endtrans %}</p>

↑ nach oben

H7120

In Jinja2 ist der Text nach {% pluralize %} die Pluralform. Hier stehen die Formen jeder Sprache im Katalog, deshalb darf dort nichts stehen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7120
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 53
    To: line 1, column 54
  Description:
    @template: between {% pluralize %} and {% endtrans %} nothing may stand: the plural forms are in the catalog
  Code:
    [no span available]

Dieses Modul scheitert mit H7120:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}<p>{% trans count=count %}Items{% pluralize %}{{ count }} items{% endtrans %}</p>

↑ nach oben

H7121

Ein Template nimmt seine Übersetzungen aus einem Katalog, einmal genannt mit {% catalog %}.

Meldung:

Error:
  Title: Generic Error
  Error code: H7121
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 22
    To: line 1, column 23
  Description:
    @template: a template names its catalog once, with one {% catalog %}
  Code:
    [no span available]

Dieses Modul scheitert mit H7121:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}{% catalog messages %}<p>{{ _("Greeting", name=user) }}</p>

↑ nach oben

H7122

Eine Übersetzung braucht den Katalog, aus dem sie kommt: {% catalog name %} steht vor dem ersten _( ) oder {% trans %} des Templates.

Meldung:

Error:
  Title: Generic Error
  Error code: H7122
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 3
    To: line 1, column 4
  Description:
    @template: a translation needs the template's catalog: {% catalog name %} before it
  Code:
    [no span available]

Dieses Modul scheitert mit H7122:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

<p>{{ _("Greeting", name=user) }}</p>

↑ nach oben

H7123

Eine Übersetzung ist Text für HTML, maskiert für die Stelle, an der sie landet, und kann nicht dort stehen, wo ein JavaScript-Ausdruck hingehört.

Meldung:

Error:
  Title: Generic Error
  Error code: H7123
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 38
    To: line 1, column 39
  Description:
    @template: a translation is text for HTML and cannot stand in a <script> element
  Code:
    [no span available]

Dieses Modul scheitert mit H7123:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}<script>var t = {{ _("Greeting", name=user) }};</script>

↑ nach oben

H7124

Eine Übersetzung steht allein in {{ }} oder als {% trans %}-Block; ein Filter oder ein ~ würde einen Text ändern, der nur im Katalog für jede Sprache derselbe ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H7124
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 25
    To: line 1, column 26
  Description:
    @template: a translation stands alone in {{ }} or a {% trans %} block, without filters and without ~
  Code:
    [no span available]

Dieses Modul scheitert mit H7124:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}<p>{{ _("Greeting", name=user)|upper }}</p>

↑ nach oben

H7125

Nach dem Schlüssel nimmt _( ) seine Argumente als name=Wert: der Name ist der Platzhalter {name} des Textes, den er füllt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7125
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 25
    To: line 1, column 26
  Description:
    @template: after the key, _( ) takes its arguments as name=value
  Code:
    [no span available]

Dieses Modul scheitert mit H7125:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}<p>{{ _("Greeting", user) }}</p>

↑ nach oben

H7126

Jedes Argument im Tag von {% trans %} hat einen eigenen Namen.

Meldung:

Error:
  Title: Generic Error
  Error code: H7126
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 25
    To: line 1, column 26
  Description:
    @template: {% trans %} is given name twice
  Code:
    [no span available]

Dieses Modul scheitert mit H7126:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}<p>{% trans name=user, name=user %}Greeting{% endtrans %}</p>

↑ nach oben

H7127

Der Code, zu dem eine Übersetzung wird, ruft Standard.I18n auf, deshalb importiert das Modul mit dem @template es, so wie es Standard.Template importiert.

Meldung:

Error:
  Title: Generic Error
  Error code: H7127
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 0
    To: line 1, column 1
  Description:
    @template: a module whose template translates imports Standard.I18n -- e.g. import Standard.I18n (Catalog); -- because the generated code calls it
  Code:
    [no span available]

Dieses Modul scheitert mit H7127:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben page.jinja:

{% catalog messages %}<p>{{ _("Greeting", name=user) }}</p>

↑ nach oben

H7128

In einem Template, das ein anderes erweitert, bleiben nur die Blöcke. {% catalog %} steht im erweiterten Template, vor den Blöcken, für die es gilt.

Meldung:

Error:
  Title: Generic Error
  Error code: H7128
  Module:
    Example
  Location:
    Filename: './page.jinja'
    From: line 1, column 26
    To: line 1, column 27
  Description:
    @template: {% catalog %} after {% extends %} stands in the template that is extended or in a block, where the text it serves is
  Code:
    [no span available]

Dieses Modul scheitert mit H7128:

import Standard.String (
    String,
    fromLiteral,
    destroyString
);
import Standard.StringBuilder (
    StringBuilder,
    makeStringBuilder,
    finalize
);
import Standard.Template (
    Render
);
import Standard.I18n (
    Message,
    Text,
    Plural,
    Language,
    Catalog,
    englishPlural,
    germanPlural
);

module body Example is
    union Key: Free is
        case Greeting;
        case Items;
    end;

    function english(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hello, {name}!");
            when Items do
                return Plural(one => "{count} item", other => "{count} items");
        end case;
    end;

    function german(key: Key): Message is
        case key of
            when Greeting do
                return Text(text => "Hallo, {name}!");
            when Items do
                return Plural(one => "{count} Teil", other => "{count} Teile");
        end case;
    end;

    function others(i: Index): Option[Language[Key]] is
        if i = 0 then
            return Some(value => Language(code => "de", texts => german, plural => germanPlural));
        end if;
        return None();
    end;

    function messages(): Catalog[Key] is
        return Catalog(default => Language(code => "en", texts => english, plural => englishPlural), others => others);
    end;

    record Page: Linear is
        lang: String;
        user: String;
        count: Int32;
    end;

    generic [R: Region]
    function render(page: &[Page, R]): String is
        var out: StringBuilder := makeStringBuilder();
        @template("page.jinja", page, out);
        return finalize(out);
    end;

    function main(): ExitCode is
        let page: Page := Page(lang => fromLiteral("de"), user => fromLiteral("Ada"), count => 2);
        let text: String := render(&page);
        destroyString(text);
        let { lang: String, user: String, count: Int32 } := page;
        destroyString(lang);
        destroyString(user);
        return ExitSuccess();
    end;
end module body.

Daneben base.jinja:

<main>{% block main %}{% endblock %}</main>

Daneben page.jinja:

{% extends "base.jinja" %}{% catalog messages %}{% block main %}{{ _("Greeting", name=user) }}{% endblock %}

↑ nach oben

8. SQL

H8001

Ein String oder ein in Anführungszeichen gesetzter Name im SQL wird nicht geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H8001
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a string is not closed (line 1, column 37 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE name = 'ann") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8001:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE name = 'ann") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8002

Ein Kommentar /* im SQL wird nicht mit */ geschlossen.

Meldung:

Error:
  Title: Generic Error
  Error code: H8002
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a comment is not closed (line 1, column 24 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users /* everyone") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8002:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users /* everyone") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8003

Ein Blob-Literal x'...' enthält keine gerade Anzahl hexadezimaler Ziffern.

Meldung:

Error:
  Title: Generic Error
  Error code: H8003
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 102
  Description:
    @execute: a blob literal is an even number of hexadecimal digits (line 1, column 32 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "DELETE FROM notes WHERE body = x'ABC'");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8003:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "DELETE FROM notes WHERE body = x'ABC'");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8004

Eine Zahl geht ohne Trennung in einen Namen über, wie in 18years.

Meldung:

Error:
  Title: Generic Error
  Error code: H8004
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a number runs into a name (line 1, column 36 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age > 18years") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8004:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age > 18years") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8005

Ein Name steht in Backticks oder eckigen Klammern. Man setzt ihn in doppelte Anführungszeichen.

Meldung:

Error:
  Title: Generic Error
  Error code: H8005
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a name is quoted with double quotes here, not with ` or [ ] (line 1, column 8 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT [name] FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8005:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT [name] FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8006

Im SQL steht ein nummerierter Parameter wie ?1. Man schreibt ? und gibt die Werte der Reihe nach an.

Meldung:

Error:
  Title: Generic Error
  Error code: H8006
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a numbered parameter (?NNN) is not accepted: write ? and give the values in order (line 1, column 36 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age > ?1", 18) for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8006:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age > ?1", 18) for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8007

Im SQL steht ein benannter Parameter wie :age. Man schreibt ? und gibt die Werte der Reihe nach an.

Meldung:

Error:
  Title: Generic Error
  Error code: H8007
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a named parameter is not accepted: write ? and give the values in order (line 1, column 36 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age > :age", 18) for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8007:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age > :age", 18) for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8008

Im SQL steht ein Zeichen, das der Compiler nicht als SQL liest, etwa #.

Meldung:

Error:
  Title: Generic Error
  Error code: H8008
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: the character '#' is not SQL this compiler reads (line 1, column 40 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age >= 18 # adults") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8008:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age >= 18 # adults") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8009

Ein Schlüsselwort fehlt, wo die Grammatik es verlangt, etwa BY nach ORDER.

Meldung:

Error:
  Title: Generic Error
  Error code: H8009
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: expected BY, found name (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users ORDER name") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8009:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users ORDER name") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8010

Ein Symbol fehlt, wo die Grammatik es verlangt, etwa die Klammer nach IN.

Meldung:

Error:
  Title: Generic Error
  Error code: H8010
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: expected (, found 18 (line 1, column 37 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age IN 18, 21") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8010:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age IN 18, 21") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8011

Ein Name fehlt, wo die Grammatik einen verlangt, etwa die Tabelle nach FROM.

Meldung:

Error:
  Title: Generic Error
  Error code: H8011
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: expected a table, found WHERE (line 1, column 18 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM WHERE age > 18") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8011:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM WHERE age > 18") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8012

Das SQL verwendet etwas, das SQLite kennt und dieser Compiler nicht annimmt, weil er ihm keinen Typ geben könnte, etwa eine Unterabfrage.

Meldung:

Error:
  Title: Generic Error
  Error code: H8012
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a subquery is not accepted in the SQL the compiler checks (line 1, column 37 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age > (SELECT avg(age) FROM users)") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8012:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age > (SELECT avg(age) FROM users)") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8013

Eine andere Funktion als count bekommt *.

Meldung:

Error:
  Title: Generic Error
  Error code: H8013
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: sum(*): only count takes * (line 1, column 8 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT sum(*) AS total FROM users") for row: Tally do
    11 |             printLn(row.total);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8013:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Tally: Free is
        total: Int64;
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT sum(*) AS total FROM users") for row: Tally do
            printLn(row.total);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8014

Eine Spalte des Ergebnisses wird ohne AS benannt.

Meldung:

Error:
  Title: Generic Error
  Error code: H8014
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a column alias is written with AS (line 1, column 20 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT upper(name) name FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8014:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT upper(name) name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8015

Auf OR in INSERT OR oder UPDATE OR folgt etwas anderes als ABORT, FAIL, IGNORE, REPLACE oder ROLLBACK.

Meldung:

Error:
  Title: Generic Error
  Error code: H8015
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 115
  Description:
    @execute: expected ABORT, FAIL, IGNORE, REPLACE or ROLLBACK after OR (line 1, column 11 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT OR SKIP INTO users (name) VALUES (?)", "ann");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8015:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT OR SKIP INTO users (name) VALUES (?)", "ann");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8016

Der Vorgabewert einer Spalte in einer Migration ist kein Literal, keine Zahl mit Vorzeichen, kein CURRENT_TIME, CURRENT_DATE oder CURRENT_TIMESTAMP und kein Ausdruck in Klammern.

Meldung:

Error:
  Title: Generic Error
  Error code: H8016
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 4, column 35
    To: line 4, column 36
  Description:
    migration: expected a default value, found now
  Code:
    [no span available]

Dieses Modul scheitert mit H8016:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    created TEXT NOT NULL DEFAULT now
) STRICT;

↑ nach oben

H8017

Ein Spaltentyp in einer Migration hat eine Größe, wie in VARCHAR(40). Eine STRICT-Tabelle kennt INT, INTEGER, REAL, TEXT und BLOB, ohne Größe.

Meldung:

Error:
  Title: Generic Error
  Error code: H8017
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 3, column 17
    To: line 3, column 18
  Description:
    migration: a size after the type name is not a STRICT type (INT, INTEGER, REAL, TEXT, BLOB)
  Code:
    [no span available]

Dieses Modul scheitert mit H8017:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name VARCHAR(40) NOT NULL
) STRICT;

↑ nach oben

H8018

Nach CONSTRAINT und seinem Namen ist eine Tabellen-Constraint weder PRIMARY KEY noch UNIQUE, CHECK oder FOREIGN KEY.

Meldung:

Error:
  Title: Generic Error
  Error code: H8018
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 4, column 26
    To: line 4, column 27
  Description:
    migration: expected a table constraint, found KEY
  Code:
    [no span available]

Dieses Modul scheitert mit H8018:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER,
    name TEXT NOT NULL,
    CONSTRAINT users_key KEY (id)
) STRICT;

↑ nach oben

H8019

Auf WITHOUT nach einer Tabelle folgt nicht ROWID.

Meldung:

Error:
  Title: Generic Error
  Error code: H8019
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 4, column 19
    To: line 4, column 20
  Description:
    migration: expected ROWID after WITHOUT
  Code:
    [no span available]

Dieses Modul scheitert mit H8019:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT, WITHOUT ROWS;

↑ nach oben

H8020

In der Liste der Tabellenoptionen steht nach einem Komma etwas anderes als STRICT oder WITHOUT ROWID.

Meldung:

Error:
  Title: Generic Error
  Error code: H8020
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 4, column 11
    To: line 4, column 12
  Description:
    migration: expected STRICT or WITHOUT ROWID, found WITHOUT_ROWID
  Code:
    [no span available]

Dieses Modul scheitert mit H8020:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT, WITHOUT_ROWID;

↑ nach oben

H8021

Bei CREATE INDEX fehlt nach der Tabelle die Klammer mit den Spalten.

Meldung:

Error:
  Title: Generic Error
  Error code: H8021
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 34
    To: line 6, column 35
  Description:
    migration: expected ( after the table
  Code:
    [no span available]

Dieses Modul scheitert mit H8021:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

CREATE INDEX users_name ON users name;

↑ nach oben

H8022

Auf ALTER TABLE folgt etwas anderes als RENAME, ADD oder DROP.

Meldung:

Error:
  Title: Generic Error
  Error code: H8022
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 19
    To: line 6, column 20
  Description:
    migration: expected RENAME, ADD or DROP after ALTER TABLE
  Code:
    [no span available]

Dieses Modul scheitert mit H8022:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

ALTER TABLE users MODIFY name TEXT;

↑ nach oben

H8023

Eine Migration legt etwas anderes als eine Tabelle oder einen Index an, etwa eine View.

Meldung:

Error:
  Title: Generic Error
  Error code: H8023
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 8
    To: line 6, column 9
  Description:
    migration: CREATE VIEW is not accepted in a migration, which creates a table (CREATE TABLE) or an index (CREATE INDEX, CREATE UNIQUE INDEX)
  Code:
    [no span available]

Dieses Modul scheitert mit H8023:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

CREATE VIEW names AS SELECT name FROM users;

↑ nach oben

H8024

Eine Migration löscht etwas anderes als eine Tabelle oder einen Index, etwa eine View.

Meldung:

Error:
  Title: Generic Error
  Error code: H8024
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 6
    To: line 6, column 7
  Description:
    migration: DROP VIEW is not accepted in a migration
  Code:
    [no span available]

Dieses Modul scheitert mit H8024:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

DROP VIEW names;

↑ nach oben

H8025

Eine Migration enthält eine andere Anweisung als CREATE TABLE, CREATE INDEX, ALTER TABLE, DROP TABLE, DROP INDEX, INSERT, UPDATE und DELETE, etwa PRAGMA.

Meldung:

Error:
  Title: Generic Error
  Error code: H8025
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 1, column 1
    To: line 1, column 2
  Description:
    migration: a migration may hold CREATE TABLE, CREATE INDEX, ALTER TABLE, DROP TABLE, DROP INDEX, INSERT, UPDATE and DELETE, not PRAGMA
  Code:
    [no span available]

Dieses Modul scheitert mit H8025:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

PRAGMA foreign_keys = ON;

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

↑ nach oben

H8026

Eine Abfrage ist weder SELECT noch INSERT, UPDATE oder DELETE. Eine Tabelle wird in einer Migration angelegt.

Meldung:

Error:
  Title: Generic Error
  Error code: H8026
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 135
  Description:
    @execute: a query is SELECT, INSERT, UPDATE or DELETE, not CREATE (line 1, column 1 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "CREATE TABLE tags (id INTEGER PRIMARY KEY, label TEXT NOT NULL) STRICT");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8026:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "CREATE TABLE tags (id INTEGER PRIMARY KEY, label TEXT NOT NULL) STRICT");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8027

Das SQL nennt eine Tabelle, die die Migrationen nicht anlegen.

Meldung:

Error:
  Title: Generic Error
  Error code: H8027
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: there is no table user in the schema the migrations build (line 1, column 18 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM user") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8027:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM user") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8028

Das SQL nennt eine Spalte, die die Tabelle nicht hat.

Meldung:

Error:
  Title: Generic Error
  Error code: H8028
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 111
  Description:
    @execute: table users has no column years (line 1, column 18 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "UPDATE users SET years = ? WHERE id = ?", 41, 1);
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8028:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "UPDATE users SET years = ? WHERE id = ?", 41, 1);
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8029

Ein Parameter steht, wo sich sein Typ nicht bestimmen lässt, etwa in ORDER BY. Ein Parameter bekommt seinen Typ von einer Spalte, mit der er verglichen oder in die er geschrieben wird.

Meldung:

Error:
  Title: Generic Error
  Error code: H8029
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: the type of parameter 1 cannot be told from where it stands: compare it with a column, or put it where a column's value goes (line 1, column 33 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users ORDER BY ?", "name") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8029:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users ORDER BY ?", "name") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8030

Eine Spalte wird mit einer Tabelle oder einem Alias qualifiziert, die die Abfrage nicht hat.

Meldung:

Error:
  Title: Generic Error
  Error code: H8030
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: there is no table or alias u in this query (line 1, column 8 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT u.name FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8030:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT u.name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8032

Eine Abfrage nennt eine Spalte und hat kein FROM, aus dem sie sie nehmen könnte.

Meldung:

Error:
  Title: Generic Error
  Error code: H8032
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: name: this query has no table to take a column from (line 1, column 8 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8032:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8033

Keine Tabelle der Abfrage hat eine Spalte dieses Namens.

Meldung:

Error:
  Title: Generic Error
  Error code: H8033
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: no table of this query has a column mail (users) (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE mail IS NULL") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8033:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE mail IS NULL") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8034

Mehr als eine Tabelle der Abfrage hat eine Spalte dieses Namens. Man stellt den Namen der Tabelle davor.

Meldung:

Error:
  Title: Generic Error
  Error code: H8034
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: more than one table of this query has a column id: name the table, as in t.id (line 1, column 48 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users JOIN notes ON user_id = id") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8034:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users JOIN notes ON user_id = id") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8035

Ein Vorzeichen steht vor etwas, das keine Zahl ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8035
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a sign in front of TEXT: only a number has one (line 1, column 33 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users ORDER BY -name") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8035:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users ORDER BY -name") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8036

NOT steht vor etwas, das keine Bedingung ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8036
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: NOT of TEXT: NOT takes a condition (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE NOT email") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8036:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE NOT email") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8037

% nimmt zwei INTEGER und bekommt ein REAL.

Meldung:

Error:
  Title: Generic Error
  Error code: H8037
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: % takes two INTEGERs (line 1, column 36 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE score % 2 = 0") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8037:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE score % 2 = 0") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8038

Es wird mit etwas gerechnet, das keine Zahl ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8038
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: INTEGER + TEXT: arithmetic takes numbers (INTEGER or REAL) (line 1, column 34 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age + '1' > 18") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8038:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age + '1' > 18") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8039

|| verbindet etwas, das kein TEXT ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8039
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: TEXT || INTEGER: || joins TEXT to TEXT (line 1, column 13 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name || age AS name FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8039:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name || age AS name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8040

Ein Wert wird mit = oder einem ähnlichen Operator mit NULL verglichen. Ein solcher Vergleich ist nie wahr; man schreibt IS NULL oder IS NOT NULL.

Meldung:

Error:
  Title: Generic Error
  Error code: H8040
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a comparison with NULL is never true: write IS NULL or IS NOT NULL (line 1, column 36 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE email = NULL") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8040:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE email = NULL") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8041

Zwei Werte verschiedenen Typs werden verglichen, etwa TEXT mit INTEGER. SQLite vergleicht sie, ohne umzuwandeln, und die Antwort hängt nie von den Werten ab.

Meldung:

Error:
  Title: Generic Error
  Error code: H8041
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: TEXT = INTEGER: SQLite compares these without converting, and the answer is always the same (line 1, column 35 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE name = 5") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8041:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE name = 5") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8042

IS vergleicht zwei Werte verschiedenen Typs, die nie gleich sein können.

Meldung:

Error:
  Title: Generic Error
  Error code: H8042
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: TEXT IS INTEGER: the two can never be the same (line 1, column 35 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE name IS 5") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8042:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE name IS 5") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8043

Ein Parameter wird auf NULL geprüft. Sein Wert ist dort bekannt, wo er übergeben wird, im Programm.

Meldung:

Error:
  Title: Generic Error
  Error code: H8043
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a parameter tested for NULL: the value is known where it is given (line 1, column 32 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE ? IS NULL", "ann") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8043:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE ? IS NULL", "ann") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8044

LIKE oder GLOB bekommt etwas, das kein TEXT ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8044
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: INTEGER LIKE TEXT: LIKE compares TEXT with TEXT (line 1, column 34 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age LIKE '3%'") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8044:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age LIKE '3%'") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8045

Ein Parameter steht links von IN. Dort steht eine Spalte.

Meldung:

Error:
  Title: Generic Error
  Error code: H8045
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a parameter on the left of IN: put a column there (line 1, column 32 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE ? IN (name, email)", "ann") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8045:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE ? IN (name, email)", "ann") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8046

NULL steht links von IN. Das ist nie wahr.

Meldung:

Error:
  Title: Generic Error
  Error code: H8046
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: NULL IN (...) is never true (line 1, column 35 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE NULL IN (email, name)") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8046:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE NULL IN (email, name)") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8047

NULL steht in der Liste von IN. Es trifft nie zu.

Meldung:

Error:
  Title: Generic Error
  Error code: H8047
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: NULL in an IN list is never matched (line 1, column 59 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE email IN ('[email protected]', NULL)") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8047:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE email IN ('[email protected]', NULL)") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8048

Ein Wert in der Liste von IN hat einen anderen Typ als der Wert links, die beiden können also nie gleich sein.

Meldung:

Error:
  Title: Generic Error
  Error code: H8048
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: INTEGER IN (... TEXT ...): the two can never be equal (line 1, column 38 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age IN ('18', '21')") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8048:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age IN ('18', '21')") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8049

Ein Parameter steht links von BETWEEN. Dort steht eine Spalte.

Meldung:

Error:
  Title: Generic Error
  Error code: H8049
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a parameter on the left of BETWEEN: put a column there (line 1, column 32 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE ? BETWEEN age AND 99", 18) for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8049:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE ? BETWEEN age AND 99", 18) for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8050

NULL steht links von BETWEEN. Das ist nie wahr.

Meldung:

Error:
  Title: Generic Error
  Error code: H8050
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: NULL BETWEEN ... is never true (line 1, column 35 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE NULL BETWEEN 1 AND 2") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8050:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE NULL BETWEEN 1 AND 2") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8051

Eine Grenze von BETWEEN hat einen anderen Typ als der Wert, mit dem sie verglichen wird.

Meldung:

Error:
  Title: Generic Error
  Error code: H8051
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: BETWEEN compares INTEGER with TEXT (line 1, column 42 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age BETWEEN '18' AND '65'") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8051:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age BETWEEN '18' AND '65'") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8052

AND oder OR verbindet etwas, das keine Bedingung ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8052
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: INTEGER AND TEXT: AND joins conditions (line 1, column 39 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age > 18 AND email") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8052:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age > 18 AND email") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8053

count(*) steht außerhalb der Spalten, von HAVING und ORDER BY, etwa in WHERE.

Meldung:

Error:
  Title: Generic Error
  Error code: H8053
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: count(*) here: an aggregate stands in the columns, HAVING or ORDER BY (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE count(*) > 1") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8053:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE count(*) > 1") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8054

Eine Aggregatfunktion steht außerhalb der Spalten, von HAVING und ORDER BY, etwa in WHERE.

Meldung:

Error:
  Title: Generic Error
  Error code: H8054
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: max() here: an aggregate stands in the columns, HAVING or ORDER BY (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE max(age) > 50") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8054:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE max(age) > 50") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8055

DISTINCT steht in einer Funktion, die keine Aggregatfunktion ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8055
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: DISTINCT inside a function that is not an aggregate (line 1, column 8 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT upper(DISTINCT name) AS name FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8055:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT upper(DISTINCT name) AS name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8056

Eine Funktion, die hier ein Argument nimmt, bekommt eine andere Anzahl.

Meldung:

Error:
  Title: Generic Error
  Error code: H8056
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: count() takes one argument here (line 1, column 8 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT count(name, email) AS total FROM users") for row: Tally do
    11 |             printLn(row.total);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8056:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Tally: Free is
        total: Int64;
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT count(name, email) AS total FROM users") for row: Tally do
            printLn(row.total);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8057

Eine Funktion, die eine Zahl nimmt, etwa abs oder sum, bekommt etwas anderes.

Meldung:

Error:
  Title: Generic Error
  Error code: H8057
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: abs() of TEXT: it takes a number (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE abs(name) > 1") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8057:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE abs(name) > 1") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8058

count bekommt einen Parameter.

Meldung:

Error:
  Title: Generic Error
  Error code: H8058
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: count() of a parameter (line 1, column 8 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT count(?) AS total FROM users", "x") for row: Tally do
    11 |             printLn(row.total);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8058:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Tally: Free is
        total: Int64;
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT count(?) AS total FROM users", "x") for row: Tally do
            printLn(row.total);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8059

min oder max bekommt einen Parameter.

Meldung:

Error:
  Title: Generic Error
  Error code: H8059
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: max() of a parameter (line 1, column 45 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users GROUP BY name HAVING max(?) > 1", 1) for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8059:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users GROUP BY name HAVING max(?) > 1", 1) for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8060

min oder max bekommt NULL.

Meldung:

Error:
  Title: Generic Error
  Error code: H8060
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: max(NULL) (line 1, column 45 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users GROUP BY name HAVING max(NULL) > 1") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8060:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users GROUP BY name HAVING max(NULL) > 1") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8061

coalesce bekommt weniger als zwei Argumente oder ifnull nicht genau zwei.

Meldung:

Error:
  Title: Generic Error
  Error code: H8061
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: ifnull() takes two arguments (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE ifnull(email) = 'x'") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8061:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE ifnull(email) = 'x'") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8062

coalesce oder ifnull bekommt nur Parameter; sein Typ lässt sich daher nicht bestimmen.

Meldung:

Error:
  Title: Generic Error
  Error code: H8062
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: coalesce() of parameters only has no type (line 1, column 38 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE email = coalesce(?, ?)", "a", "b") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8062:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE email = coalesce(?, ?)", "a", "b") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8063

Der erste Wert von coalesce oder ifnull, der kein Parameter ist, ist NULL.

Meldung:

Error:
  Title: Generic Error
  Error code: H8063
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: coalesce() whose first value is NULL (line 1, column 39 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE coalesce(NULL, email) = 'x'") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8063:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE coalesce(NULL, email) = 'x'") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8064

coalesce oder ifnull bekommt Werte verschiedenen Typs.

Meldung:

Error:
  Title: Generic Error
  Error code: H8064
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: coalesce() of TEXT and INTEGER (line 1, column 46 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE coalesce(email, 0) = 'x'") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8064:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE coalesce(email, 0) = 'x'") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8065

length bekommt etwas anderes als TEXT oder BLOB.

Meldung:

Error:
  Title: Generic Error
  Error code: H8065
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: length() of INTEGER: it takes TEXT or BLOB (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE length(age) > 1") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8065:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE length(age) > 1") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8066

lower oder upper bekommt etwas anderes als TEXT.

Meldung:

Error:
  Title: Generic Error
  Error code: H8066
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: upper() of INTEGER: it takes TEXT (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE upper(age) = 'X'") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8066:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE upper(age) = 'X'") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8067

Das SQL ruft eine Funktion auf, deren Typ der Compiler nicht kennt. Er kennt count, sum, total, avg, min, max, coalesce, ifnull, length, lower, upper und abs.

Meldung:

Error:
  Title: Generic Error
  Error code: H8067
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: trim() is not one of the functions whose type the compiler knows: count, sum, total, avg, min, max, coalesce, ifnull, length, lower, upper, abs (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE trim(name) = 'x'") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8067:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE trim(name) = 'x'") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8068

Zwei Parameter treffen an einem Operator aufeinander, und keiner gibt dem anderen einen Typ.

Meldung:

Error:
  Title: Generic Error
  Error code: H8068
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: two parameters meet, and neither says what type the other is (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE ? = ?", "a", "b") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8068:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE ? = ?", "a", "b") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8069

Ein WHERE, ON, HAVING oder CHECK bekommt etwas, das keine Bedingung ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8069
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: the WHERE condition is TEXT, and it has to be a condition (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE email") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8069:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE email") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8070

Eine Spalte des Ergebnisses hat einen Namen, der kein Feld des Zeilen-Records benennen kann, etwa einen Namen mit Leerzeichen oder ein Hilde-Schlüsselwort.

Meldung:

Error:
  Title: Generic Error
  Error code: H8070
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: the column loud name cannot name a field of the row type: give it a name with AS (line 1, column 8 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT upper(name) AS \"loud name\" FROM users") for row: Shout[Q] do
    11 |             printLn(row.shout);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8070:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Shout[R: Region]: Free is
        shout: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT upper(name) AS \"loud name\" FROM users") for row: Shout[Q] do
            printLn(row.shout);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8071

* steht in einer Abfrage ohne Tabelle.

Meldung:

Error:
  Title: Generic Error
  Error code: H8071
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 8
    To: line 18, column 16
  Description:
    @query: * without a table (line 1, column 8 of the SQL)
  Code:
    12 |     generic [R: Region]
    13 |     function run(db: &![Connection[Writing], R]): Unit is
    14 |         @query(&~db, "SELECT *") for row: User[Q] do
    15 |             printLn(row.name);
    16 |         else error do
    17 |             printLn(describe(error));
    18 |         end for;
    19 |         return nil;
    20 |     end;

Dieses Modul scheitert mit H8071:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record User[R: Region]: Free is
        id: Int64;
        name: Span[Nat8, R];
        age: Int64;
        email: Option[Span[Nat8, R]];
        score: Option[Float64];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT *") for row: User[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8072

t.* nennt eine Tabelle oder einen Alias, die die Abfrage nicht hat.

Meldung:

Error:
  Title: Generic Error
  Error code: H8072
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 14, column 8
    To: line 18, column 16
  Description:
    @query: there is no table or alias u in this query (line 1, column 8 of the SQL)
  Code:
    12 |     generic [R: Region]
    13 |     function run(db: &![Connection[Writing], R]): Unit is
    14 |         @query(&~db, "SELECT u.* FROM users") for row: User[Q] do
    15 |             printLn(row.name);
    16 |         else error do
    17 |             printLn(describe(error));
    18 |         end for;
    19 |         return nil;
    20 |     end;

Dieses Modul scheitert mit H8072:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record User[R: Region]: Free is
        id: Int64;
        name: Span[Nat8, R];
        age: Int64;
        email: Option[Span[Nat8, R]];
        score: Option[Float64];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT u.* FROM users") for row: User[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8073

Eine Spalte des Ergebnisses ist immer NULL und hat deshalb keinen Typ.

Meldung:

Error:
  Title: Generic Error
  Error code: H8073
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: this column is always NULL and has no type (line 1, column 14 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name, NULL AS note FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8073:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name, NULL AS note FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8074

Eine Spalte des Ergebnisses, die keine einfache Spalte ist, hat keinen Namen. Man gibt ihr einen mit AS.

Meldung:

Error:
  Title: Generic Error
  Error code: H8074
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: a column that is not a plain column needs a name: write AS (line 1, column 8 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT upper(name) FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8074:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT upper(name) FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8075

Zwei Spalten des Ergebnisses haben denselben Namen.

Meldung:

Error:
  Title: Generic Error
  Error code: H8075
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: two columns of the result are called name: rename one with AS (line 1, column 8 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name, lower(name) AS name FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8075:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name, lower(name) AS name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8076

NULL wird in eine Spalte geschrieben, die NOT NULL ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8076
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 103
  Description:
    @execute: NULL into name, which is NOT NULL (line 1, column 34 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (name) VALUES (NULL)");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8076:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (name) VALUES (NULL)");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8077

Ein Wert eines anderen Typs wird in eine Spalte geschrieben. Eine STRICT-Tabelle lehnt ihn beim Lauf des Programms ab.

Meldung:

Error:
  Title: Generic Error
  Error code: H8077
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 118
  Description:
    @execute: TEXT into age, a INTEGER column: a STRICT table refuses it (line 1, column 42 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (name, age) VALUES (?, '40')", "ann");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8077:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (name, age) VALUES (?, '40')", "ann");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8078

Ein Wert, der NULL sein kann, wird in eine Spalte geschrieben, die NOT NULL ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8078
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 94
  Description:
    @execute: a value that may be NULL into name, which is NOT NULL (line 1, column 25 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "UPDATE users SET name = email");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8078:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "UPDATE users SET name = email");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8079

Eine Tabelle steht zweimal in FROM, ohne einen Alias, der die beiden unterscheidet.

Meldung:

Error:
  Title: Generic Error
  Error code: H8079
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: users stands twice in FROM: give one an alias (line 1, column 29 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users JOIN users ON age = age") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8079:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users JOIN users ON age = age") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8081

LIMIT oder OFFSET bekommt etwas anderes als ein INTEGER, das nicht NULL ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8081
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: LIMIT and OFFSET take an INTEGER that is not NULL (line 1, column 30 of the SQL)
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users LIMIT '10'") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8081:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users LIMIT '10'") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8082

Die Spaltenliste eines INSERT nennt eine Spalte zweimal.

Meldung:

Error:
  Title: Generic Error
  Error code: H8082
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 123
  Description:
    @execute: name is named twice (line 1, column 26 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (name, name) VALUES (?, ?)", "ann", "bob");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8082:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (name, name) VALUES (?, ?)", "ann", "bob");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8083

Ein INSERT lässt eine Spalte aus, die NOT NULL ist und keinen Vorgabewert hat.

Meldung:

Error:
  Title: Generic Error
  Error code: H8083
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 103
  Description:
    @execute: the INSERT leaves out name, which is NOT NULL and has no DEFAULT (line 1, column 13 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (age) VALUES (?)", 40);
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8083:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (age) VALUES (?)", 40);
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8084

Ein INSERT hat eine Spaltenliste und DEFAULT VALUES.

Meldung:

Error:
  Title: Generic Error
  Error code: H8084
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 104
  Description:
    @execute: DEFAULT VALUES with a column list (line 1, column 13 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (name) DEFAULT VALUES");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8084:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (name) DEFAULT VALUES");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8085

Eine Zeile eines INSERT hat eine andere Anzahl Werte, als es Spalten gibt.

Meldung:

Error:
  Title: Generic Error
  Error code: H8085
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 112
  Description:
    @execute: a row of 1 values for 2 columns (line 1, column 13 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (name, age) VALUES (?)", "ann");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8085:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "INSERT INTO users (name, age) VALUES (?)", "ann");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8086

Eine Spalte in einer Migration hat den Typ ANY. Der Compiler prüft eine Abfrage gegen eine Spalte mit INT, INTEGER, REAL, TEXT oder BLOB.

Meldung:

Error:
  Title: Generic Error
  Error code: H8086
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 4, column 5
    To: line 4, column 6
  Description:
    migration: extra is ANY: a column the compiler checks against has one of INT, INTEGER, REAL, TEXT, BLOB
  Code:
    [no span available]

Dieses Modul scheitert mit H8086:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    extra ANY
) STRICT;

↑ nach oben

H8087

Eine Spalte in einer Migration hat keinen Typ. Eine STRICT-Tabelle gibt jeder Spalte einen.

Meldung:

Error:
  Title: Generic Error
  Error code: H8087
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 4, column 5
    To: line 4, column 6
  Description:
    migration: nickname has no type: a STRICT table gives every column one
  Code:
    [no span available]

Dieses Modul scheitert mit H8087:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    nickname
) STRICT;

↑ nach oben

H8088

Eine Spalte in einer Migration hat einen Typ, den eine STRICT-Tabelle nicht kennt, etwa DATE.

Meldung:

Error:
  Title: Generic Error
  Error code: H8088
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 4, column 5
    To: line 4, column 6
  Description:
    migration: born is DATE, which is not a STRICT type: INT, INTEGER, REAL, TEXT, BLOB
  Code:
    [no span available]

Dieses Modul scheitert mit H8088:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    born DATE
) STRICT;

↑ nach oben

H8089

Eine Migration legt eine Tabelle an, die es schon gibt.

Meldung:

Error:
  Title: Generic Error
  Error code: H8089
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 14
    To: line 6, column 15
  Description:
    migration: table users exists already
  Code:
    [no span available]

Dieses Modul scheitert mit H8089:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    email TEXT
) STRICT;

↑ nach oben

H8090

Eine Tabelle wird ohne STRICT angelegt. Ohne STRICT speichert SQLite einen Wert jedes Typs in jeder Spalte, und die Typen, die der Compiler prüft, würden nicht gelten.

Meldung:

Error:
  Title: Generic Error
  Error code: H8090
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 1, column 14
    To: line 1, column 15
  Description:
    migration: table users is not STRICT: without STRICT, SQLite stores a value of any type in any column, and the types the compiler checks would not hold
  Code:
    [no span available]

Dieses Modul scheitert mit H8090:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
);

↑ nach oben

H8091

Eine Tabelle definiert eine Spalte zweimal.

Meldung:

Error:
  Title: Generic Error
  Error code: H8091
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 4, column 5
    To: line 4, column 6
  Description:
    migration: column name is defined twice
  Code:
    [no span available]

Dieses Modul scheitert mit H8091:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    name TEXT
) STRICT;

↑ nach oben

H8092

Eine Tabelle hat mehr als einen PRIMARY KEY.

Meldung:

Error:
  Title: Generic Error
  Error code: H8092
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 1, column 14
    To: line 1, column 15
  Description:
    migration: table users has more than one PRIMARY KEY
  Code:
    [no span available]

Dieses Modul scheitert mit H8092:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL PRIMARY KEY
) STRICT;

↑ nach oben

H8093

Der PRIMARY KEY einer Tabelle nennt eine Spalte, die die Tabelle nicht hat.

Meldung:

Error:
  Title: Generic Error
  Error code: H8093
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 1, column 14
    To: line 1, column 15
  Description:
    migration: the PRIMARY KEY names user_id, which is not a column of users
  Code:
    [no span available]

Dieses Modul scheitert mit H8093:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER,
    name TEXT NOT NULL,
    PRIMARY KEY (user_id)
) STRICT;

↑ nach oben

H8094

ALTER TABLE ADD COLUMN fügt eine Spalte hinzu, die die Tabelle schon hat.

Meldung:

Error:
  Title: Generic Error
  Error code: H8094
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 30
    To: line 6, column 31
  Description:
    migration: table users has a column name already
  Code:
    [no span available]

Dieses Modul scheitert mit H8094:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

ALTER TABLE users ADD COLUMN name TEXT;

↑ nach oben

H8095

ALTER TABLE ADD COLUMN fügt einen PRIMARY KEY hinzu. SQLite kann einer bestehenden Tabelle keinen hinzufügen.

Meldung:

Error:
  Title: Generic Error
  Error code: H8095
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 30
    To: line 6, column 31
  Description:
    migration: ALTER TABLE ADD COLUMN cannot add a PRIMARY KEY
  Code:
    [no span available]

Dieses Modul scheitert mit H8095:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

ALTER TABLE users ADD COLUMN code INTEGER PRIMARY KEY;

↑ nach oben

H8096

ALTER TABLE ADD COLUMN fügt eine NOT-NULL-Spalte ohne Vorgabewert hinzu. SQLite lehnt eine solche Spalte bei einer Tabelle mit Zeilen ab.

Meldung:

Error:
  Title: Generic Error
  Error code: H8096
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 30
    To: line 6, column 31
  Description:
    migration: city is NOT NULL without a DEFAULT, and SQLite refuses to add such a column to a table that has rows
  Code:
    [no span available]

Dieses Modul scheitert mit H8096:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

ALTER TABLE users ADD COLUMN city TEXT NOT NULL;

↑ nach oben

H8097

ALTER TABLE RENAME TO gibt einer Tabelle den Namen einer Tabelle, die es gibt.

Meldung:

Error:
  Title: Generic Error
  Error code: H8097
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 11, column 13
    To: line 11, column 14
  Description:
    migration: table users exists already
  Code:
    [no span available]

Dieses Modul scheitert mit H8097:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

CREATE TABLE people (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

ALTER TABLE people RENAME TO users;

↑ nach oben

H8098

ALTER TABLE RENAME COLUMN gibt einer Spalte den Namen einer Spalte, die die Tabelle hat.

Meldung:

Error:
  Title: Generic Error
  Error code: H8098
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 7, column 33
    To: line 7, column 34
  Description:
    migration: table users has a column name already
  Code:
    [no span available]

Dieses Modul scheitert mit H8098:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    email TEXT
) STRICT;

ALTER TABLE users RENAME COLUMN email TO name;

↑ nach oben

H8099

ALTER TABLE DROP COLUMN löscht die letzte Spalte einer Tabelle. Stattdessen löscht man die Tabelle.

Meldung:

Error:
  Title: Generic Error
  Error code: H8099
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 8, column 30
    To: line 8, column 31
  Description:
    migration: a table cannot lose its last column
  Code:
    [no span available]

Dieses Modul scheitert mit H8099:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

CREATE TABLE tags (label TEXT) STRICT;

ALTER TABLE tags DROP COLUMN label;

↑ nach oben

H8100

DROP TABLE löscht eine Tabelle, die es nicht gibt.

Meldung:

Error:
  Title: Generic Error
  Error code: H8100
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 12
    To: line 6, column 13
  Description:
    migration: there is no table tags to drop
  Code:
    [no span available]

Dieses Modul scheitert mit H8100:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

DROP TABLE tags;

↑ nach oben

H8101

CREATE INDEX legt einen Index an, dessen Name schon vergeben ist.

Meldung:

Error:
  Title: Generic Error
  Error code: H8101
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 8, column 14
    To: line 8, column 15
  Description:
    migration: index users_key exists already
  Code:
    [no span available]

Dieses Modul scheitert mit H8101:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

CREATE INDEX users_key ON users (name);

CREATE INDEX users_key ON users (id, name);

↑ nach oben

H8102

DROP INDEX löscht einen Index, den es nicht gibt.

Meldung:

Error:
  Title: Generic Error
  Error code: H8102
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 12
    To: line 6, column 13
  Description:
    migration: there is no index users_name to drop
  Code:
    [no span available]

Dieses Modul scheitert mit H8102:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

DROP INDEX users_name;

↑ nach oben

H8103

Eine Migrationsdatei lässt sich nicht lesen, etwa weil ein Verzeichnis den Namen einer Migration trägt.

Meldung:

Error:
  Title: Generic Error
  Error code: H8103
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: cannot read ./migrations/2-more.sql: it is a directory, not a file
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8103:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

Daneben migrations/2-more.sql/README:

This directory is not a migration.

↑ nach oben

H8104

Neben dem Modul gibt es kein Verzeichnis migrations. Das Schema, gegen das eine Abfrage geprüft wird, entsteht aus den Migrationen in diesem Verzeichnis.

Meldung:

Error:
  Title: Generic Error
  Error code: H8104
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: there is no directory ./migrations: the schema a query is checked against is the migrations beside the module
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8104:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migration/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

↑ nach oben

H8105

Das Verzeichnis migrations enthält keine Datei, die auf .sql endet.

Meldung:

Error:
  Title: Generic Error
  Error code: H8105
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: ./migrations holds no .sql file
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8105:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.txt:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

↑ nach oben

H8106

Eine Datei in migrations heißt nicht <Nummer>-<Name>.sql mit einer Nummer ab 1.

Meldung:

Error:
  Title: Generic Error
  Error code: H8106
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: ./migrations/schema.sql: a migration is called <number>-<name>.sql, numbered from 1
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8106:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

↑ nach oben

H8107

Die Migrationen sind nicht lückenlos mit 1, 2, 3 und so weiter nummeriert, oder eine Nummer kommt zweimal vor.

Meldung:

Error:
  Title: Generic Error
  Error code: H8107
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: ./migrations/3-email.sql: migration 2 is missing or doubled; they are numbered 1, 2, 3 ... without a gap
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8107:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

Daneben migrations/3-email.sql:

ALTER TABLE users ADD COLUMN email TEXT;

↑ nach oben

H8108

Auf eine Anweisung in einer Migration folgt kein ;, bevor die nächste beginnt.

Meldung:

Error:
  Title: Generic Error
  Error code: H8108
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 1
    To: line 6, column 2
  Description:
    migration: expected ; after the statement, found CREATE
  Code:
    [no span available]

Dieses Modul scheitert mit H8108:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT

CREATE INDEX users_name ON users (name);

↑ nach oben

H8109

Eine Migration enthält einen Parameter ?. Eine Migration läuft so, wie sie dasteht; ein Parameter darin hat nichts, wofür er stehen könnte.

Meldung:

Error:
  Title: Generic Error
  Error code: H8109
  Module:
    Example
  Location:
    Filename: './migrations/1-schema.sql'
    From: line 6, column 34
    To: line 6, column 35
  Description:
    migration: a migration has no parameters
  Code:
    [no span available]

Dieses Modul scheitert mit H8109:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
) STRICT;

INSERT INTO users (name) VALUES (?);

↑ nach oben

H8110

Ein Modul, das @query, @execute oder @migrations verwendet, importiert weder Standard.Sqlite noch Standard.SqlCipher. Der erzeugte Code ruft eines von beiden auf, und der Import wählt, welches.

Meldung:

Error:
  Title: Generic Error
  Error code: H8110
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 16
    To: line 3, column 27
  Description:
    @migrations: a module that uses @migrations imports Standard.Sqlite or Standard.SqlCipher -- e.g. `import Standard.Sqlite (Connection);' -- because the generated code calls it
  Code:
    1 | module body Example is
    2 |     function main(): ExitCode is
    3 |         printLn(@migrations);
    4 |         return ExitSuccess();
    5 |     end;

Dieses Modul scheitert mit H8110:

module body Example is
    function main(): ExitCode is
        printLn(@migrations);
        return ExitSuccess();
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8111

Das SQL eines @query oder @execute enthält mehr als eine Anweisung.

Meldung:

Error:
  Title: Generic Error
  Error code: H8111
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 101
  Description:
    @execute: one statement per query; found DELETE after it (line 1, column 20 of the SQL)
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "DELETE FROM notes; DELETE FROM users");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8111:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "DELETE FROM notes; DELETE FROM users");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8112

Das SQL hat eine andere Anzahl Parameter ?, als Werte übergeben werden.

Meldung:

Error:
  Title: Generic Error
  Error code: H8112
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: the SQL has 1 parameter and 0 values are given
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "SELECT name FROM users WHERE age > ?") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8112:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users WHERE age > ?") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8113

Der Zeilentyp von @query ist kein Record, geschrieben Name oder Name[R], wobei R die Region ist, unter der der Text der Zeile verliehen wird.

Meldung:

Error:
  Title: Generic Error
  Error code: H8113
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 8
    To: line 10, column 16
  Description:
    @query: the row type is a record, written `Name' or `Name[R]' with R the region the row's text is lent under
  Code:
     4 |     generic [R: Region]
     5 |     function run(db: &![Connection[Writing], R]): Unit is
     6 |         @query(&~db, "SELECT name FROM users") for row: Span[Nat8, Q] do
     7 |             printLn(row);
     8 |         else error do
     9 |             printLn(describe(error));
    10 |         end for;
    11 |         return nil;
    12 |     end;

Dieses Modul scheitert mit H8113:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "SELECT name FROM users") for row: Span[Nat8, Q] do
            printLn(row);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8115

@query bekommt eine Anweisung, die keine Zeilen liefert. Man schreibt sie mit @execute oder ergänzt RETURNING.

Meldung:

Error:
  Title: Generic Error
  Error code: H8115
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 10, column 8
    To: line 14, column 16
  Description:
    @query: this statement returns no rows: write it with @execute, or add RETURNING
  Code:
     8 |     generic [R: Region]
     9 |     function run(db: &![Connection[Writing], R]): Unit is
    10 |         @query(&~db, "DELETE FROM users WHERE age > 99") for row: Person[Q] do
    11 |             printLn(row.name);
    12 |         else error do
    13 |             printLn(describe(error));
    14 |         end for;
    15 |         return nil;
    16 |     end;

Dieses Modul scheitert mit H8115:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    record Person[R: Region]: Free is
        name: Span[Nat8, R];
    end;

    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        @query(&~db, "DELETE FROM users WHERE age > 99") for row: Person[Q] do
            printLn(row.name);
        else error do
            printLn(describe(error));
        end for;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

H8116

@execute bekommt eine Anweisung, die Zeilen liefert. Man schreibt sie mit @query ... for.

Meldung:

Error:
  Title: Generic Error
  Error code: H8116
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 6, column 47
    To: line 6, column 87
  Description:
    @execute: this statement returns rows: write it with @query ... for
  Code:
    4 |     generic [R: Region]
    5 |     function run(db: &![Connection[Writing], R]): Unit is
    6 |         let result: Either[SqlError, Nat64] := @execute(&~db, "SELECT name FROM users");
    7 |         case result of
    8 |             when Left(left as error: SqlError) do

Dieses Modul scheitert mit H8116:

import Standard.Sqlite (Connection, Writing, SqlError, describe, openWriter, closeDatabase, migrate);

module body Example is
    generic [R: Region]
    function run(db: &![Connection[Writing], R]): Unit is
        let result: Either[SqlError, Nat64] := @execute(&~db, "SELECT name FROM users");
        case result of
            when Left(left as error: SqlError) do
                printLn(describe(error));
            when Right(right as changed: Nat64) do
                printLn(changed);
        end case;
        return nil;
    end;

    function main(): ExitCode is
        case openWriter(":memory:") of
            when Left(left as error: SqlError) do
                printLn(describe(error));
                return ExitFailure();
            when Right(right as opened: Connection[Writing]) do
                var db: Connection[Writing] := opened;
                case migrate(&!db, @migrations) of
                    when Left(left as error: SqlError) do
                        printLn(describe(error));
                    when Right(right as applied: Index) do
                        run(&!db);
                end case;
                closeDatabase(db);
                return ExitSuccess();
        end case;
    end;
end module body.

Daneben migrations/1-schema.sql:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER NOT NULL DEFAULT 0,
    email TEXT,
    score REAL
) STRICT;

CREATE TABLE notes (
    id INTEGER PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users (id),
    body BLOB NOT NULL
) STRICT;

↑ nach oben

9. Verträge

H2051

Der Body einer öffentlichen Funktion trägt requires-, ensures- oder raises-Klauseln. Der Vertrag einer öffentlichen Funktion steht einmal, in ihrem Interface, wo jeder Aufrufer ihn liest. Die Meldung nennt die Stelle des Vertrags im Interface, oder die der Deklaration, wenn das Interface keinen hat.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2051
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 22
  Description:
    The body of the public function `half` holds a contract.
    
    The contract of a public function stands in its interface only: it is written at `Example.hih:3`.  Remove the requires, ensures and raises clauses from the body.
  Code:
    1 | module body Example is
    2 |     function half(n: Nat32): Nat32
    3 |         requires n > 0
    4 |     is
    5 |         return n / 2;

Dieses Modul scheitert mit H2051:

module body Example is
    function half(n: Nat32): Nat32
        requires n > 0
    is
        return n / 2;
    end;

    function main(): ExitCode is
        printLn(half(8));
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Example is
    function half(n: Nat32): Nat32
        requires n > 0;

    function main(): ExitCode;
end module.

↑ nach oben

H2052

Eine aus C importierte Funktion hat einen Vertrag. Der Compiler prüft einen Vertrag mit Anweisungen, die er in den Body der Funktion setzt, und eine mit Foreign_Import eingebundene Funktion hat keinen eigenen Body.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2052
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 4
    To: line 8, column 8
  Description:
    The function `cAbs` is imported from C and has a contract.
    
    A contract is checked by statements put into the body of its function, and a foreign function has none.  Write the contract on a Hilde function that calls it.
  Code:
     3 | module body Example is
     4 |     pragma Foreign_Import(External_Name => "abs");
     5 |     function cAbs(value: Int32): Int32
     6 |         requires value > -100
     7 |     is
     8 |     end;
     9 | 
    10 |     function main(): ExitCode is

Dieses Modul scheitert mit H2052:

pragma Unsafe_Module;

module body Example is
    pragma Foreign_Import(External_Name => "abs");
    function cAbs(value: Int32): Int32
        requires value > -100
    is
    end;

    function main(): ExitCode is
        printLn(cAbs(-5));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2053

Ein ensures nennt eine Variable, die der Body der Funktion deklariert. Ein ensures wird bei jedem return geprüft, wo die Variablen des Bodys noch gelten; ein Name, den der Body deklariert, würde dort gelesen statt des gleich geschriebenen Namens des Moduls. Das ensures liest nur die Parameter, result und alte Werte.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2053
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 30
  Description:
    The ensures of `addThree` names `limit`, which the body of the function also declares.
    
    An ensures sees the parameters, result and the names of modules; checked at a return, it would read the body's variable instead.  Rename the variable in the body.
  Code:
    1 | module body Example is
    2 |     function addThree(n: Nat32): Nat32
    3 |         ensures result > limit
    4 |     is
    5 |         let limit: Nat32 := 3;

Dieses Modul scheitert mit H2053:

module body Example is
    function addThree(n: Nat32): Nat32
        ensures result > limit
    is
        let limit: Nat32 := 3;
        return n + limit;
    end;

    function main(): ExitCode is
        printLn(addThree(4));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2054

Eine Funktion mit einem ensures hat einen Parameter namens result. In einem ensures steht der Name result für den Wert, den die Funktion zurückgibt; ein Parameter dieses Namens wäre dort nicht zu lesen.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2054
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 6, column 8
  Description:
    The function `doubled` has an ensures and a parameter named `result`.
    
    In an ensures, result is the value the function returns.  Rename the parameter.
  Code:
    1 | module body Example is
    2 |     function doubled(result: Nat32): Nat32
    3 |         ensures result > 0
    4 |     is
    5 |         return result * 2;
    6 |     end;
    7 | 
    8 |     function main(): ExitCode is

Dieses Modul scheitert mit H2054:

module body Example is
    function doubled(result: Nat32): Nat32
        ensures result > 0
    is
        return result * 2;
    end;

    function main(): ExitCode is
        printLn(doubled(4));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2055

old steht, wo es nichts bedeutet: in einem requires, in einem anderen old oder mit anderem als einem Wert. old(e) ist der Wert, den e beim Eintritt in die Funktion hatte, bei ihrer Rückkehr wieder gelesen; in einem requires, das beim Eintritt geprüft wird, sagte es nichts. Die erste Zeile der Meldung sagt, welcher der drei Fälle vorliegt.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2055
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 27
  Description:
    An old(e) stands in a requires.
    
    old(e) stands only in an ensures, takes one value, and does not nest: it is the value e had when the function was entered.
  Code:
    1 | module body Example is
    2 |     function half(n: Nat32): Nat32
    3 |         requires old(n) > 0
    4 |     is
    5 |         return n / 2;

Dieses Modul scheitert mit H2055:

module body Example is
    function half(n: Nat32): Nat32
        requires old(n) > 0
    is
        return n / 2;
    end;

    function main(): ExitCode is
        printLn(half(8));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2056

Eine Testfunktion hat ein requires. Ein verletztes requires nennt den Aufruf, der es gebrochen hat, und kein Aufruf im Programm ruft einen Test: das tut hilde test. Ein Test prüft, was er braucht, in seinem Body, mit den Zusicherungen von Standard.Testing.

Meldung:

FAIL  Example.hiq  the test programme did not build
hilde test: 1 test file, 0 tests, 0 failed, 1 not built
Error:
  Title: Declaration Error
  Error code: H2056
  Module:
    Example.Test
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 6, column 8
  Description:
    The test `testHalf` has a requires.
    
    A violated requires names the call that broke it, and a test is called by hilde test, not by a call in the programme.  Check the condition in the test's body instead.
  Code:
    1 | module body Example.Test is
    2 |     function testHalf(): Unit
    3 |         requires argumentCount() > 0
    4 |     is
    5 |         return nil;
    6 |     end;
    7 | end module body.

Dieses Modul scheitert mit H2056:

module body Example.Test is
    function testHalf(): Unit
        requires argumentCount() > 0
    is
        return nil;
    end;
end module body.

Mit diesem Aufruf:

hilde test Example.hiq

↑ nach oben

H2057

Ein Record mit einer Invariante lässt sich außerhalb seines Moduls bauen oder beschreiben. Eine Invariante wird bei der Rückkehr der öffentlichen Funktionen des Moduls geprüft, wo ein Wert das Modul verlässt. Das hält sie nur, wenn kein anderes Modul den Record bauen oder seine Slots zuweisen kann, und so ist es, wenn das Interface den Typ opak oder gar nicht deklariert. Ein Modul ohne Interface hat keinen privaten Record.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2057
  Module:
    Example
  Location:
    Filename: 'Example.hih'
    From: line 2, column 4
    To: line 6, column 8
  Description:
    The record `Range` has an invariant, and its slots can be reached outside its module: its slots stand in the interface.
    
    An invariant is checked where a value leaves its module, which holds only when no other module can build the record or write its slots.  Declare the type opaque in the interface, type Name: Universe;, and the record in the body.
  Code:
    1 | module Example is
    2 |     record Range: Free is
    3 |         low: Nat32;
    4 |         high: Nat32;
    5 |         invariant low <= high;
    6 |     end;
    7 | 
    8 |     function main(): ExitCode;

Dieses Modul scheitert mit H2057:

module body Example is
    function main(): ExitCode is
        let r: Range := Range(low => 1, high => 2);
        printLn(r.high);
        return ExitSuccess();
    end;
end module body.

Daneben Example.hih:

module Example is
    record Range: Free is
        low: Nat32;
        high: Nat32;
        invariant low <= high;
    end;

    function main(): ExitCode;
end module.

↑ nach oben

H3096

Eine Bedingung verwendet einen linearen Wert selbst statt über eine Referenz. Eine Bedingung liest nur. Ein linearer Wert, selbst verwendet, wird verbraucht, und die Funktion hätte ihn verloren, bevor ihr Body läuft.

Meldung:

Error:
  Title: Type Error
  Error code: H3096
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 12, column 8
    To: line 12, column 35
  Description:
    This condition uses the linear value `token` itself, which would consume it.
    
    A condition only reads: read a linear value through a reference, `&token`.
  Code:
    10 | 
    11 |     function spend(token: Token): Nat32
    12 |         requires valueOf(token) > 0
    13 |     is
    14 |         return valueOf(token);

Dieses Modul scheitert mit H3096:

module body Example is
    record Token: Linear is
        value: Nat32;
    end;

    function valueOf(token: Token): Nat32 is
        let { value: Nat32 } := token;
        return value;
    end;

    function spend(token: Token): Nat32
        requires valueOf(token) > 0
    is
        return valueOf(token);
    end;

    function main(): ExitCode is
        printLn(spend(Token(value => 3)));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3097

Eine Bedingung nimmt eine Referenz zum Schreiben. Eine Bedingung liest nur; eine Referenz zum Schreiben hat darin keinen Platz. Eine Schreibreferenz, die ein Parameter ist, wird mit & gelesen.

Meldung:

Error:
  Title: Type Error
  Error code: H3097
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 19, column 8
    To: line 19, column 36
  Description:
    This condition makes a reference to write through, with `&!`, `&~` or a writable span.
    
    A condition only reads: take a read reference with & instead.
  Code:
    17 |     generic [R: Region]
    18 |     function current(counter: &![Counter, R]): Nat32
    19 |         requires bump(&~counter) > 0
    20 |     is
    21 |         return counter->count;

Dieses Modul scheitert mit H3097:

module body Example is
    record Counter: Linear is
        count: Nat32;
    end;

    generic [R: Region]
    function peek(counter: &[Counter, R]): Nat32 is
        return counter->count;
    end;

    generic [R: Region]
    function bump(counter: &![Counter, R]): Nat32 is
        counter->count := counter->count + 1;
        return counter->count;
    end;

    generic [R: Region]
    function current(counter: &![Counter, R]): Nat32
        requires bump(&~counter) > 0
    is
        return counter->count;
    end;

    function main(): ExitCode is
        var c: Counter := Counter(count => 1);
        printLn(current(&!c));
        let { count: Nat32 } := c;
        printLn(count);
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3098

Eine Bedingung ruft eine Funktion, die ein Binding-Modul, C oder eine Referenz zum Schreiben erreicht. Der Compiler verfolgt jeden Aufruf einer Bedingung durch die Bodys der Funktionen, die er erreicht, bis in jede Tiefe. Die Meldung gibt die Kette der Aufrufe und was ihre letzte Funktion tut: Sie steht in einem Modul, dessen Name mit Bindings. beginnt, sie ist aus C importiert oder schreibt C mit @embed, oder sie nimmt eine Referenz zum Schreiben. In das eigene Modul des Compilers, Hilde.Pervasive, wird nicht hineingesehen; seine Parameter werden geprüft.

Meldung:

Error:
  Title: Type Error
  Error code: H3098
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 25, column 8
    To: line 25, column 36
  Description:
    This condition calls `Example.countedTwice -> Example.bump`, which asks for a reference to write through.
    
    A condition only reads: every function it calls, and every function those call, stays out of the binding modules and C, and asks for no reference to write through.
  Code:
    23 | 
    24 |     function half(n: Nat32): Nat32
    25 |         requires countedTwice(n) > 0
    26 |     is
    27 |         return n / 2;

Dieses Modul scheitert mit H3098:

module body Example is
    record Counter: Linear is
        count: Nat32;
    end;

    generic [R: Region]
    function peek(counter: &[Counter, R]): Nat32 is
        return counter->count;
    end;

    generic [R: Region]
    function bump(counter: &![Counter, R]): Nat32 is
        counter->count := counter->count + 1;
        return counter->count;
    end;

    function countedTwice(n: Nat32): Nat32 is
        var c: Counter := Counter(count => n);
        let first: Nat32 := bump(&!c);
        let { count: Nat32 } := c;
        return first + count;
    end;

    function half(n: Nat32): Nat32
        requires countedTwice(n) > 0
    is
        return n / 2;
    end;

    function main(): ExitCode is
        printLn(half(8));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3099

Eine Bedingung ruft über einen Funktionszeiger oder eine Methode eines Typparameters. Welche Funktion läuft, entscheidet sich später, am Wert des Zeigers oder am Typ, für den der Parameter steht, und der Compiler kann dort, wo die Bedingung geprüft wird, nicht in sie hineinsehen.

Meldung:

Error:
  Title: Type Error
  Error code: H3099
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 7, column 8
    To: line 7, column 25
  Description:
    This condition calls through the function pointer f, so the function that runs is not known where the condition is checked.
    
    A condition only reads, and the compiler has to see every function it calls to know that.  Call a function by its name.
  Code:
    5 | 
    6 |     function apply(f: Fn[Nat32, Nat32], n: Nat32): Nat32
    7 |         requires f(n) > 0
    8 |     is
    9 |         return f(n);

Dieses Modul scheitert mit H3099:

module body Example is
    function double(n: Nat32): Nat32 is
        return n * 2;
    end;

    function apply(f: Fn[Nat32, Nat32], n: Nat32): Nat32
        requires f(n) > 0
    is
        return f(n);
    end;

    function main(): ExitCode is
        printLn(apply(double, 4));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3100

old bekommt einen Wert, der nicht frei ist. old hebt eine Kopie seines Werts vom Eintritt bis zur Rückkehr auf, und ein linearer Wert lässt sich nicht kopieren.

Meldung:

Error:
  Title: Type Error
  Error code: H3100
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 16, column 8
    To: line 16, column 52
  Description:
    old takes a value of the type `Token`, which is not in the Free universe.
    
    old copies a value when the function is entered, and only a free value can be copied.
  Code:
    14 | 
    15 |     function plusOne(n: Nat32): Nat32
    16 |         ensures result = (n + valueOf(old(fresh())))
    17 |     is
    18 |         return n + 1;

Dieses Modul scheitert mit H3100:

module body Example is
    record Token: Linear is
        value: Nat32;
    end;

    function valueOf(token: Token): Nat32 is
        let { value: Nat32 } := token;
        return value;
    end;

    function fresh(): Token is
        return Token(value => 1);
    end;

    function plusOne(n: Nat32): Nat32
        ensures result = (n + valueOf(old(fresh())))
    is
        return n + 1;
    end;

    function main(): ExitCode is
        printLn(plusOne(4));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3101

Eine Funktion mit einem requires wird als Funktionszeiger genommen. Der Compiler gibt jedem Aufruf einer Funktion mit einem requires die Stelle des Aufrufs mit, für die Meldung einer verletzten Bedingung; ein Aufruf über einen Zeiger hat keine solche Stelle.

Meldung:

Error:
  Title: Type Error
  Error code: H3101
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 9, column 8
    To: line 9, column 40
  Description:
    The function `half` has a requires and cannot be taken as a function pointer.
    
    A violated requires names the call that broke it, and a call through a pointer has no place the compiler can name.  Call the function directly, or write a function without a requires that calls it.
  Code:
     7 | 
     8 |     function main(): ExitCode is
     9 |         let f: Fn[Nat32, Nat32] := half;
    10 |         printLn(f(8));
    11 |         return ExitSuccess();

Dieses Modul scheitert mit H3101:

module body Example is
    function half(n: Nat32): Nat32
        requires n > 0
    is
        return n / 2;
    end;

    function main(): ExitCode is
        let f: Fn[Nat32, Nat32] := half;
        printLn(f(8));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H5008

Die Einstiegsfunktion hat ein requires. Ein verletztes requires nennt den Aufruf, der es gebrochen hat, und kein Aufruf im Programm ruft die Einstiegsfunktion.

Meldung:

Error:
  Title: Entrypoint Definition Error
  Error code: H5008
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The entrypoint function has a requires.
    
    A violated requires names the call that broke it, and the entrypoint is called by the system, not by a call in the programme.  Check the condition at the start of the function's body instead.
  Code:
    [no span available]

Dieses Modul scheitert mit H5008:

module body Example is
    function main(): ExitCode
        requires argumentCount() > 0
    is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

10. Fehlerarten

H2058

Die Methode einer Instanz trägt eine raises-Klausel. Die raises-Klausel einer Methode steht einmal, an der Deklaration der Methode in der Typklasse, wo jede Instanz und jeder Aufrufer sie liest; eine Instanz erbt sie. Eine Klausel an der Methode der Instanz wäre ein zweites Versprechen, das nichts gegen das erste hält, deshalb wird sie abgewiesen. Die Meldung nennt die Methode.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2058
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 9, column 12
    To: line 9, column 25
  Description:
    The method `measure` of an instance has a raises clause.
    
    The raises clause of a method stands in the typeclass, where every instance and every caller reads it.  Remove the clause from the instance, and write it at the method's declaration in the typeclass.
  Code:
     7 |     instance Measure(Int32) is
     8 |         method measure(value: Int32): Int32
     9 |             raises Broken is
    10 |             return value * 2;
    11 |         end;

Dieses Modul scheitert mit H2058:

module body Example is
    typeclass Measure(T: Free) is
        method measure(value: T): Int32
            raises Broken;
    end;

    instance Measure(Int32) is
        method measure(value: Int32): Int32
            raises Broken is
            return value * 2;
        end;
    end;

    function main(): ExitCode
        raises Broken is
        printLn(measure(21));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3102

Ein raise nennt eine Art, die die raises-Klausel der Funktion nicht nennt. Eine Funktion darf nur die Arten auslösen, die ihre eigene Klausel nennt. Die Meldung nennt die ausgelöste Art und die Arten der Klausel, oder sagt, dass die Funktion keine Klausel hat.

Meldung:

Error:
  Title: Type Error
  Error code: H3102
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 5, column 12
    To: line 5, column 25
  Description:
    The raise of `Denied` is not among the kinds this function's raises clause names: `NotFound`.  Name the kind in the raises clause of this function, or raise a kind it names.
  Code:
    3 |         raises NotFound is
    4 |         if n < 0 then
    5 |             raise Denied;
    6 |         end if;
    7 |         return n;

Dieses Modul scheitert mit H3102:

module body Example is
    function pick(n: Int32): Int32
        raises NotFound is
        if n < 0 then
            raise Denied;
        end if;
        return n;
    end;

    function main(): ExitCode
        raises NotFound is
        printLn(pick(7));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3103

Ein Aufruf kann mit einer Fehlerart enden, die die raises-Klausel des Aufrufers nicht nennt. Eine Funktion darf nur Funktionen aufrufen, deren Fehlerarten sie selbst nennt, damit eine Art keinen Aufrufer erreicht, der sie nicht versprochen hat; die Einstiegsfunktion unterliegt derselben Regel. Die Meldung nennt das Ziel, die fehlenden Arten und die Arten, die der Aufrufer nennt. Ein Methodenaufruf wird an der Klausel der Deklaration der Methode in der Typklasse gemessen.

Meldung:

Error:
  Title: Type Error
  Error code: H3103
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 25
  Description:
    The call of `Example.pick` can end with the error kind(s) `NotFound`, but this function's raises clause names: `no kinds (no raises clause)`.  A function may call only the functions whose error kinds it has named; name the missing kind(s) in the raises clause of this function, or take the call out.
  Code:
     6 | 
     7 |     function main(): ExitCode is
     8 |         printLn(pick(7));
     9 |         return ExitSuccess();
    10 |     end;

Dieses Modul scheitert mit H3103:

module body Example is
    function pick(n: Int32): Int32
        raises NotFound is
        return n;
    end;

    function main(): ExitCode is
        printLn(pick(7));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3104

Eine Funktion mit einer raises-Klausel wird als Funktionszeiger genommen. Ein Aufruf über einen Zeiger hat keine Signatur, die der Compiler gegen die Klausel des Aufrufers halten könnte; eine solche Funktion wird nur bei ihrem Namen aufgerufen.

Meldung:

Error:
  Title: Type Error
  Error code: H3104
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 9, column 8
    To: line 9, column 40
  Description:
    The function `pick` has a raises clause and cannot be taken as a function pointer.
    
    A call through a pointer has no signature the compiler can hold against the caller's raises clause.  Call the function directly.
  Code:
     7 |     function main(): ExitCode
     8 |         raises NotFound is
     9 |         let f: Fn[Int32, Int32] := pick;
    10 |         printLn(f(7));
    11 |         return ExitSuccess();

Dieses Modul scheitert mit H3104:

module body Example is
    function pick(n: Int32): Int32
        raises NotFound is
        return n;
    end;

    function main(): ExitCode
        raises NotFound is
        let f: Fn[Int32, Int32] := pick;
        printLn(f(7));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

11. Never und Slots

H2060

Ein return steht in einer Funktion, die Never zurückgibt. Eine solche Funktion hat keinen Wert zurückzugeben, also erreicht kein Pfad durch sie ein return.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2060
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 3, column 19
  Description:
    A return stands in a function that returns `Never`.
    
    A function that returns Never does not come back: it ends in a call of a function that returns Never, in a raise or in a loop that never ends.
  Code:
    1 | module body Example is
    2 |     function stop(): Never is
    3 |         return nil;
    4 |     end;
    5 | 

Dieses Modul scheitert mit H2060:

module body Example is
    function stop(): Never is
        return nil;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2061

Eine Funktion, die Never zurückgibt, hat einen Pfad, der das Ende ihres Rumpfs erreicht. Hier hat das if kein else, also läuft der Pfad mit b gleich false durch.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2061
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 8
    To: line 5, column 15
  Description:
    The function `stop` returns `Never` but a path through it comes to its end.
    
    Every path ends in a call of a function that returns Never, in a raise or in a while whose condition is true.
  Code:
    1 | module body Example is
    2 |     function stop(b: Bool): Never is
    3 |         if b then
    4 |             abort("stopped");
    5 |         end if;
    6 |     end;
    7 | 

Dieses Modul scheitert mit H2061:

module body Example is
    function stop(b: Bool): Never is
        if b then
            abort("stopped");
        end if;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2062

Eine Funktion, die Never zurückgibt, trägt eine ensures-Klausel. Die Klausel würde an einem return geprüft, und es gibt keines.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2062
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 2, column 4
    To: line 6, column 8
  Description:
    The function `stop` returns `Never` and has an ensures.
    
    An ensures speaks of the state at a return, and a function that returns Never does not return: the clause would hold of nothing.  Remove it; a requires stays allowed.
  Code:
    1 | module body Example is
    2 |     function stop(n: Int32): Never
    3 |         ensures n > 0
    4 |     is
    5 |         abort("stopped");
    6 |     end;
    7 | 
    8 |     function main(): ExitCode is

Dieses Modul scheitert mit H2062:

module body Example is
    function stop(n: Int32): Never
        ensures n > 0
    is
        abort("stopped");
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2063

Ein Slot hat weder einen Standardrumpf noch eine Implementierung im Programm. Die Prüfung läuft, wenn das letzte Modul des Programms übersetzt wird.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2063
  Module:
    [unknown]
  Location:
    Filename: 'Greeting.hih'
    From: line 4, column 4
    To: line 4, column 27
  Description:
    The slot `Greeting.greet` has no default body and no function of the programme implements it.
    
    Give the declaration a body in the module, or mark one function with pragma Implements(Name => "Greeting.greet").
  Code:
    2 |     -- Says hello; the programme implements it.
    3 |     pragma Slot;
    4 |     function greet(): Unit;
    5 | end module.

Dieses Modul scheitert mit H2063:

import Greeting (
    greet
);

module body Example is
    function main(): ExitCode is
        greet();
        return ExitSuccess();
    end;
end module body.

Daneben Greeting.hih:

module Greeting is
    -- Says hello; the programme implements it.
    pragma Slot;
    function greet(): Unit;
end module.

Daneben Greeting.hiq:

module body Greeting is
end module body.

↑ nach oben

H2064

Zwei Funktionen des Programms implementieren denselben Slot. Ein Slot hat eine Implementierung, sonst wüsste der Compiler nicht, welche er aufruft.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2064
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 4
    To: line 10, column 8
  Description:
    The slot `Hilde.Pervasive.onOverflow` is implemented twice: by `Example.first` and by `Example.second`.
    
    A slot has one implementation in a programme; remove the pragma Implements from one of them.
  Code:
     6 | 
     7 |     pragma Implements(Name => "Hilde.Pervasive.onOverflow");
     8 |     function second(message: Span[Nat8, Static]): Never is
     9 |         abort(message);
    10 |     end;
    11 | 
    12 |     function main(): ExitCode is

Dieses Modul scheitert mit H2064:

module body Example is
    pragma Implements(Name => "Hilde.Pervasive.onOverflow");
    function first(message: Span[Nat8, Static]): Never is
        abort(message);
    end;

    pragma Implements(Name => "Hilde.Pervasive.onOverflow");
    function second(message: Span[Nat8, Static]): Never is
        abort(message);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2065

Eine Implementierung eines Slots hat eine andere Signatur als der Slot. Die Parameter stimmen in Zahl, Name und Typ überein, und die Ergebnistypen sind gleich.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2065
  Module:
    [unknown]
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 4
    To: line 5, column 8
  Description:
    The function `Example.handled` implements the slot `Hilde.Pervasive.onOverflow` but its signature differs: the parameter message: Span[Nat8, Static] of the slot is text: Span[Nat8, Static] in the implementation.
    
    An implementation has the parameters of the slot, with their names and types, and its result type.
  Code:
    1 | module body Example is
    2 |     pragma Implements(Name => "Hilde.Pervasive.onOverflow");
    3 |     function handled(text: Span[Nat8, Static]): Never is
    4 |         abort(text);
    5 |     end;
    6 | 
    7 |     function main(): ExitCode is

Dieses Modul scheitert mit H2065:

module body Example is
    pragma Implements(Name => "Hilde.Pervasive.onOverflow");
    function handled(text: Span[Nat8, Static]): Never is
        abort(text);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2066

Ein pragma Implements nennt etwas, das kein Slot ist. Der Name wird unter den Slots der Module gesucht, die vor diesem übersetzt wurden.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2066
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 4
    To: line 5, column 8
  Description:
    The function `Example.handled` implements `Hilde.Pervasive.nowhere`, which is not a slot of a module compiled before it.
    
    The name is Module.function of a declaration with pragma Slot, and the implementing module imports that module.
  Code:
    1 | module body Example is
    2 |     pragma Implements(Name => "Hilde.Pervasive.nowhere");
    3 |     function handled(message: Span[Nat8, Static]): Never is
    4 |         abort(message);
    5 |     end;
    6 | 
    7 |     function main(): ExitCode is

Dieses Modul scheitert mit H2066:

module body Example is
    pragma Implements(Name => "Hilde.Pervasive.nowhere");
    function handled(message: Span[Nat8, Static]): Never is
        abort(message);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H2067

Ein pragma Slot oder pragma Implements steht, wo es nichts bedeutet: Slot an einer Funktionsdefinition, Implements an einer Deklaration eines Interface, eines von beiden an einer Funktion, die über einen Typ generisch ist, oder beide an derselben Funktion. Ein Slot, der nur über Regionen generisch ist, ist erlaubt: Eine Region hat zur Laufzeit keine Form, und jede Instanz ist dieselbe Funktion. Die erste Zeile der Meldung sagt, welcher Fall es ist.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2067
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 3, column 4
    To: line 6, column 8
  Description:
    A function generic over a type cannot be a slot or implement one.
    
    pragma Slot stands at a function declaration in an interface, and pragma Implements at a function definition that is not a slot; neither at a function generic over anything but regions.
  Code:
    1 | module body Example is
    2 |     pragma Implements(Name => "Hilde.Pervasive.onOverflow");
    3 |     generic [T: Free]
    4 |     function handled(message: Span[Nat8, Static], other: T): Never is
    5 |         abort(message);
    6 |     end;
    7 | 
    8 |     function main(): ExitCode is

Dieses Modul scheitert mit H2067:

module body Example is
    pragma Implements(Name => "Hilde.Pervasive.onOverflow");
    generic [T: Free]
    function handled(message: Span[Nat8, Static], other: T): Never is
        abort(message);
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3109

Never steht als Typ von etwas, das einen Wert hält: ein Parameter, eine Variable, ein Feld eines Records oder einer Union, eine Konstante, eine Konversion, eine Größe, ein Funktionszeiger oder ein Typargument. Never hat keinen Wert, also kann nur das Ergebnis einer Funktion oder Methode ihn haben.

Meldung:

Error:
  Title: Type Error
  Error code: H3109
  Module:
    Example
  Location:
    [no span available]
  Description:
    `Never` cannot be the type of a parameter: it has no value.
    
    Only the return type of a function or a method may be Never.
  Code:
    [no span available]

Dieses Modul scheitert mit H3109:

module body Example is
    function take(x: Never): Unit is
        return nil;
    end;

    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

↑ nach oben

H3110

Ein Aufruf einer Funktion, die Never zurückgibt, ist ein Argument oder ein Operand. Der Aufruf liefert nie einen Wert, also könnte der Ausdruck um ihn nie fertig werden. Ein let, eine Zuweisung, ein return und ein Zweig eines if-Ausdrucks dürfen einen solchen Aufruf weiter halten.

Meldung:

Error:
  Title: Type Error
  Error code: H3110
  Module:
    Example
  Location:
    Filename: 'Example.hiq'
    From: line 8, column 8
    To: line 8, column 31
  Description:
    A call that does not come back stands where its value would be passed on.
    
    Its result is Never; call it as a statement of its own.
  Code:
     6 | 
     7 |     function main(): ExitCode is
     8 |         show(abort("stopped"));
     9 |         return ExitSuccess();
    10 |     end;

Dieses Modul scheitert mit H3110:

module body Example is
    function show(n: Int32): Unit is
        printLn(n);
        return nil;
    end;

    function main(): ExitCode is
        show(abort("stopped"));
        return ExitSuccess();
    end;
end module body.

↑ nach oben

12. Ziele

H1038

Kein Compiler für wasm32-wasi wird gefunden. hilde findet ihn selbst: zig, gegeben als HILDE_ZIG oder im Pfad, das die C-Bibliothek von WASI mitbringt, sonst clang im Pfad mit wasm-ld und der C-Bibliothek von WASI. HILDE_WASM_CC=zig oder clang nimmt diesen und scheitert, wenn er fehlt; dann nennt ihn die Meldung. Das Beispiel nimmt den Pfad weg.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1038
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    No compiler for WebAssembly was found.
    
    hilde looks for zig, given as `HILDE_ZIG` or on the path, and then for clang on the path with `wasm-ld` and the C library of WASI, in `WASI_SYSROOT`, /usr/share/wasi-sysroot, /opt/wasi-sdk/share/wasi-sysroot or where Debian's wasi-libc puts it. Install zig, or clang with lld and wasi-libc.
    
    A compiler for WebAssembly is needed only for --target=wasm and --target-type=wasm; zig is taken at version 0.17.0 only.
  Code:
    [no span available]

Dieses Modul scheitert mit H1038:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

env HILDE_ZIG= PATH=/nonexistent hilde build Example.hiq --target=wasm --entrypoint=Example:main --output=prog.wasm

↑ nach oben

H1039

HILDE_WASM_CC nennt einen Compiler, den hilde für WebAssembly nicht kennt. Es wählt zwischen den beiden, nach denen hilde sucht, zig und clang; ein falsch geschriebener Name wird abgewiesen, statt als nicht gesetzt zu gelten.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1039
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `HILDE_WASM_CC` is `gcc`, which is not a compiler hilde knows for WebAssembly.
    
    It is `zig` or `clang`, or not set, and then zig is taken when it is there.
  Code:
    [no span available]

Dieses Modul scheitert mit H1039:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

env HILDE_WASM_CC=gcc hilde build Example.hiq --target=wasm --entrypoint=Example:main --output=prog.wasm

↑ nach oben

H1040

hilde test --target=wasm findet keine Laufzeit für WebAssembly. Die Testprogramme sind Kommandomodule, und wasmtime führt sie aus.

Meldung:

No runtime for WebAssembly was found to run the tests.

hilde runs a module for wasm32-wasi with wasmtime, given as `HILDE_WASMTIME` or on the path.

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1041

--target nennt kein Ziel, für das hilde baut. Die Namen sind die fünf von pragma Targets; für einen Namen, der wenige Buchstaben von einem entfernt ist, schlägt die Meldung diesen vor.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1041
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `--target=wsam` names no target hilde builds for.
    
    The targets are `linux, openbsd, freebsd, darwin, wasm`.
  Code:
    [no span available]

Dieses Modul scheitert mit H1041:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde build Example.hiq --target=wsam --entrypoint=Example:main --output=prog

↑ nach oben

H1042

--target nennt ein anderes System als das, auf dem hilde läuft. Ein Binary baut der C-Compiler der Maschine und linkt es gegen ihre C-Bibliothek, also wird es auf einer Maschine des Systems gebaut, für das es ist; nur WebAssembly, ein Modul, das auf jedem System läuft, wird überall gebaut.

Meldung:

`--target=<name>` asks for a binary of another system, and hilde builds a binary only for the system it runs on, <host>.

Build on a machine of `<name>`, or build a module for WebAssembly with `--target=wasm`.

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1043

--target=wasm steht bei einem Archiv oder einem Shared Object. WebAssembly hat zwei Formen eines Moduls: ein Kommando, ein Programm mit main, und einen Reaktor, eine Bibliothek, die ihr Host aufruft.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1043
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `--target=wasm` cannot build `--target-type=static`: there is no archive and no shared object for WebAssembly.
    
    A programme with an entrypoint becomes a command module, `--target-type=wasm` a library module, a reactor.
  Code:
    [no span available]

Dieses Modul scheitert mit H1043:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde build Example.hiq --target=wasm --target-type=static --output=libexample.a

↑ nach oben

H1044

Die Ausgabe eines Programms für wasm endet nicht auf .wasm. Ein Modul ist kein Binary des Systems: Sein Name sagt, was es ist, und wasmtime und ein Host in JavaScript nehmen es unter diesem Namen.

Meldung:

Error:
  Title: Command Line Arguments Error
  Error code: H1044
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    The output of `--target=wasm` is a module for wasm32-wasi and must end in `.wasm`, and `prog` does not.
  Code:
    [no span available]

Dieses Modul scheitert mit H1044:

module body Example is
    function main(): ExitCode is
        return ExitSuccess();
    end;
end module body.

Mit diesem Aufruf:

hilde build Example.hiq --target=wasm --entrypoint=Example:main --output=prog

↑ nach oben

H2068

Ein pragma Targets nennt kein Ziel, eines doppelt, eines, das es nicht gibt, oder ein Instead, das kein Modul ist. Instead nennt ein Modul mit seinem vollen Namen, und nur, wo ein Ziel fehlt.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2068
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    Invalid `pragma Targets`: plan9 is no target.
    
    It takes `Names`, the targets separated by one space each, out of `linux, openbsd, freebsd, darwin, wasm`, and after it, where another module does the work on the other targets, `Instead`: `pragma Targets(Names => "linux openbsd freebsd darwin", Instead => "Standard.Regex");`
  Code:
    [no span available]

Dieses Modul scheitert mit H2068:

import Standard.Thing (
    size
);

module body Example is
    function main(): ExitCode is
        let n: Index := size();
        return ExitSuccess();
    end;
end module body.

Daneben Thing.hih:

pragma Targets(Names => "linux plan9");
module Standard.Thing is
    function size(): Index;
end module.

Daneben Thing.hiq:

module body Standard.Thing is
    function size(): Index is
        return 1;
    end;
end module body.

↑ nach oben

H2069

Ein anderes Pragma als ein pragma Targets steht vor einem Modul-Interface. Was ein Modul bindet und ob es unsicher ist, steht vor seinem Body.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2069
  Module:
    [unknown]
  Location:
    [no span available]
  Description:
    `pragma Unsafe_Module` cannot stand before a module interface.
    
    Only `pragma Targets` stands there, once.
  Code:
    [no span available]

Dieses Modul scheitert mit H2069:

import Standard.Thing (
    size
);

module body Example is
    function main(): ExitCode is
        let n: Index := size();
        return ExitSuccess();
    end;
end module body.

Daneben Thing.hih:

pragma Unsafe_Module;
pragma Targets(Names => "linux openbsd freebsd darwin wasm");
module Standard.Thing is
    function size(): Index;
end module.

Daneben Thing.hiq:

module body Standard.Thing is
    function size(): Index is
        return 1;
    end;
end module body.

↑ nach oben

H2070

Ein Modul außerhalb der Standardbibliothek nennt seine Ziele. Ein Programm wählt die Ziele nicht, für die es gebaut wird: Es gibt es für die der Module, die es importiert, und der Compiler hält es daran. Die Standardbibliothek ist ein Modul, dessen Name mit Standard. oder Bindings. beginnt.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2070
  Module:
    Thing
  Location:
    [no span available]
  Description:
    `Thing` names its targets with `pragma Targets`, and only a module of the standard library does.
    
    A programme is there for the targets of the modules it imports: what differs between the targets is in the standard library, and a programme holds no code for one target only.
  Code:
    [no span available]

Dieses Modul scheitert mit H2070:

import Thing (
    size
);

module body Example is
    function main(): ExitCode is
        let n: Index := size();
        return ExitSuccess();
    end;
end module body.

Daneben Thing.hih:

pragma Targets(Names => "linux openbsd freebsd darwin wasm");
module Thing is
    function size(): Index;
end module.

Daneben Thing.hiq:

module body Thing is
    function size(): Index is
        return 1;
    end;
end module body.

↑ nach oben

H2071

Ein Interface der Standardbibliothek nennt keine Ziele. Jedes Modul, dessen Name mit Standard. beginnt, sagt, für welche Ziele es es gibt, damit ein Programm, das für eines gebaut wird, es an seinen Importen merkt und nicht beim Linken.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2071
  Module:
    Standard.Thing
  Location:
    [no span available]
  Description:
    The module `Standard.Thing` of the standard library names no targets.
    
    Its interface says before its imports which targets it is there for: `pragma Targets(Names => "linux openbsd freebsd darwin wasm");`
  Code:
    [no span available]

Dieses Modul scheitert mit H2071:

import Standard.Thing (
    size
);

module body Example is
    function main(): ExitCode is
        let n: Index := size();
        return ExitSuccess();
    end;
end module body.

Daneben Thing.hih:

module Standard.Thing is
    function size(): Index;
end module.

Daneben Thing.hiq:

module body Standard.Thing is
    function size(): Index is
        return 1;
    end;
end module body.

↑ nach oben

H2072

Ein Modul nennt ein Ziel, für das es einen seiner Importe nicht gibt. Das gilt, wofür das Programm auch gebaut wird, also können die Ziele der Standardbibliothek nicht mehr behaupten, als sie haben.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2072
  Module:
    Standard.Thing
  Location:
    [no span available]
  Description:
    `Standard.Thing` names the target `wasm`, but imports `Standard.Other`, which is not there for it.
    
    A module is there only for targets all its imports are there for: take `wasm` out of its pragma Targets, or make the import there for it.
  Code:
    [no span available]

Dieses Modul scheitert mit H2072:

import Standard.Thing (
    size
);

module body Example is
    function main(): ExitCode is
        let n: Index := size();
        return ExitSuccess();
    end;
end module body.

Daneben Thing.hih:

pragma Targets(Names => "linux openbsd freebsd darwin wasm");
import Standard.Other (
    one
);
module Standard.Thing is
    function size(): Index;
end module.

Daneben Thing.hiq:

module body Standard.Thing is
    function size(): Index is
        return 1;
    end;
end module body.

Daneben Other.hih:

pragma Targets(Names => "linux openbsd freebsd darwin");
module Standard.Other is
    function one(): Index;
end module.

Daneben Other.hiq:

module body Standard.Other is
    function one(): Index is
        return 1;
    end;
end module body.

↑ nach oben

H2073

Ein Programm, das für ein Ziel gebaut wird, importiert ein Modul, das es dafür nicht gibt. Die Meldung nennt die Ziele, für die es das Modul gibt, und, wo sein pragma Targets eines nennt, das Modul, das stattdessen zu nehmen ist; --error-format=json und hilde-json tragen dieses Modul als Vorschlag.

Meldung:

Error:
  Title: Declaration Error
  Error code: H2073
  Module:
    Example
  Location:
    [no span available]
  Description:
    `Standard.Thing` is not there for the target `wasm`, and `Example` imports it.
    
    It is there for linux, openbsd, freebsd, darwin. Take `Standard.Other` instead.
    
    Suggested fix: `Standard.Other`
  Code:
    [no span available]

Dieses Modul scheitert mit H2073:

import Standard.Thing (
    size
);

module body Example is
    function main(): ExitCode is
        let n: Index := size();
        return ExitSuccess();
    end;
end module body.

Daneben Thing.hih:

pragma Targets(Names => "linux openbsd freebsd darwin", Instead => "Standard.Other");
module Standard.Thing is
    function size(): Index;
end module.

Daneben Thing.hiq:

module body Standard.Thing is
    function size(): Index is
        return 1;
    end;
end module body.

Mit diesem Aufruf:

hilde build Thing.hih,Thing.hiq Example.hiq --target=wasm --target-type=c --entrypoint=Example:main --output=prog.c

↑ nach oben

13. Pakete

H1045

Ein Paketkommando wurde gegeben, und hilde-pkg liegt nicht neben dem Compiler.

Meldung:

The package commands are carried out by `path`, which is not there.
Build it beside the compiler with `make hilde-pkg`, or install both with `make install`.

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1046

hilde-pkg liegt neben dem Compiler und ließ sich nicht starten.

Meldung:

`path` could not be started: why.
Check that it may be run, or build it again with `make hilde-pkg`.

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1501

Das Kommando braucht ein Paket, und im Verzeichnis liegt keine hilde.toml.

Meldung:

no hilde.toml in .

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1502

hilde.toml ist kein TOML; die Meldung nennt Zeile und Spalte.

Meldung:

hilde.toml is not TOML: what, at line L, column C

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1503

hilde.toml hat einen Schlüssel oder eine Tabelle, die ein Manifest nicht hat, etwa einen vertippten.

Meldung:

hilde.toml has the key k in table, which a manifest does not have

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1504

Ein Schlüssel, den hilde.toml haben muss, fehlt: Name oder Version des Pakets, git-URL oder Version einer Anforderung.

Meldung:

package.name is missing in hilde.toml

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1505

Ein Wert hat die falsche Form: ein Name, der kein Modulpräfix ist, eine Version, die nicht vX.Y.Z ist, eine Fähigkeit, die es nicht gibt, oder ein Argument falscher Form.

Meldung:

hilde get takes [email protected], not text

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1506

Ein Präfix kommt von zwei git-URLs, oder ein Paket heißt anders als das Präfix, unter dem es verlangt wird.

Meldung:

the package at URL is named N, and P requires it as Q

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1507

git ist nicht im PATH, und das Kommando braucht es.

Meldung:

git is not on PATH, and hilde export reads the tags with git

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1508

git ist gescheitert: eine falsche URL, ein Repository, das nicht gelesen werden darf, oder ein Programm, das sich nicht starten ließ.

Meldung:

git cannot list the tags of URL: git said: line

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1509

Das Repository hat keinen Tag der verlangten Version; der Vorschlag nennt die nächstliegenden Tags.

Meldung:

the repository URL has no tag vX.Y.Z

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1510

Der Baum eines Pakets enthält einen symbolischen Link oder eine Sonderdatei.

Meldung:

a package holds only files and directories, not a link or a special file: path

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1511

Ein Release hat keine Signatur, und die Richtlinie des Pakets verlangt eine.

Meldung:

the release of P has no signature, and policy.require-signatures is true

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1512

Eine Signatur hält nicht, der Schlüssel ist nicht der bei der ersten Verwendung übernommene, oder ein Release ist nach einem signierten unsigniert.

Meldung:

the signature of P does not hold for its tree and its key

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1513

Der geheime Schlüssel lässt sich nicht lesen, ist kein signify-Schlüssel oder hat eine Passphrase.

Meldung:

path is not a secret key of signify without a passphrase

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1514

hilde.sum fehlt, hat eine falsche Zeile oder keine Zeile für eine Anforderung.

Meldung:

hilde.sum, line N: what

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1515

Ein Baum in vendor/ fehlt, ist geändert oder steht nicht in hilde.sum.

Meldung:

vendor/ has no tree P, which hilde.sum names

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1516

Zwei Hauptversionen eines Pakets werden verlangt; eine neue Hauptversion bekommt ein neues Präfix.

Meldung:

P is required as vA by X and as vB by Y

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1517

Der Baum eines Pakets ist tiefer als 64 Verzeichnisse.

Meldung:

the tree is deeper than 64 directories at: path

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1518

Ein Verzeichnis oder eine Datei eines Pakets lässt sich nicht lesen.

Meldung:

a directory cannot be read: path

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1519

Eine Datei oder ein Verzeichnis lässt sich nicht schreiben.

Meldung:

llms.txt or man/man3 cannot be written in root

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1521

hilde new oder ein Schlüssel würde über etwas schreiben, das schon da ist.

Meldung:

the directory is there already: path

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1522

hilde doc findet kein Modul und keine Deklaration des Namens.

Meldung:

no module or declaration X in src, vendor/ or the standard library

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1523

Ein Ziel aus hilde.toml erlaubt das pragma Targets eines erreichten Moduls nicht.

Meldung:

hilde.toml names the target T, and a module the package reaches does not allow it: M

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1530

Die Version eines Releases ist niedriger, als die Änderung der Schnittstelle verlangt, etwa ein Bruch unter einer Nebenversion.

Meldung:

the interface changed as a major release does since vA, and hilde.toml says vB

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1531

Ein Modul des Pakets hat keine Testdatei.

Meldung:

a release needs a test file for each module, and these are missing: files

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1532

Die Tests des Pakets laufen nicht durch, oder der Compiler scheiterte daran.

Meldung:

the tests of the package do not pass: last line

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1533

Eine exportierte Funktion wird in keinem Test aufgerufen.

Meldung:

every exported function must be called in a test, and these are not: names

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1534

Die Version eines Releases ist nicht neuer als der neueste Tag.

Meldung:

hilde.toml says vA, and the newest tag is vB

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1535

Keine cargo gefunden: keines auf PATH und keines in HILDE_CARGO genannt.

Meldung:

hilde.toml names Rust crates, and there is no cargo on PATH and no HILDE_CARGO

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1536

Die Umgebung oder eine Konfiguration von cargo verlangt panic = "abort", unter dem keine Bridge einen panic fangen kann.

Meldung:

the environment variable NAME sets panic to abort, and with abort catch_unwind catches nothing, so a panic in a bridge would end the programme

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1537

Eine Datei in rust/bridge ist kein Bridge-Modul, es gibt keines, oder eine Funktion einer Bridge beginnt nicht mit dem Guard.

Meldung:

rust/bridge holds FILE, which is no bridge module

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1538

cargo schlug fehl, schrieb keine statische Bibliothek, schrieb eine zweite oder nannte keine nativen Bibliotheken.

Meldung:

cargo ended and wrote no libNAME.a to DIR

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1539

Meldung:

there is no rust/Cargo.lock, and cargo builds only from a lock file that is checked in

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1540

Die rust-toolchain.toml oder das Guard-Crate rust/hilde-bridge neben dem Compiler fehlt oder nennt keine feste Version.

Meldung:

the rust-toolchain.toml beside the compiler in DIR names no channel X.Y.Z

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1541

Der Wert von --target ist nicht wie ein Ziel von rustc geschrieben.

Meldung:

the target TRIPLE is not a target of rustc

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

14. Sperli

H1047

Ein run-Kommando wurde gegeben, und hilde-launcher liegt nicht neben dem Compiler.

Meldung:

The command run is carried out by `path`, which is not there.
Build it beside the compiler with `make hilde-launcher`, or install both with `make install`.

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1048

hilde-launcher liegt neben dem Compiler und ließ sich nicht starten.

Meldung:

`path` could not be started: why.
Check that it may be run, or build it again with `make hilde-launcher`.

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1601

Der Partner zeigte kein Zertifikat, eines, für das die CA des Jobs nicht bürgt, oder bot eine TLS-Version unter 1.3 an.

Meldung:

the peer has no certificate of the job CA

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1602

Der Subject des Zertifikats des Partners ist nicht der Job und der Rang, für den die Verbindung gilt.

Meldung:

the subject of the certificate is not the job and rank of the peer

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1603

Ein Host steht in SPERLI_REFUSED_HOSTS, ist host-a.invalid oder host-b.invalid oder ein Name darunter oder steht auf der Sperrliste des Betreibers; eine Sperrliste hebt die Regel nicht auf.

Meldung:

the host is refused

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1604

Das Join-Token eines Partners ist abgelaufen.

Meldung:

the join token has expired

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1605

Das Join-Token eines Partners wurde für einen anderen Job ausgestellt.

Meldung:

the join token is for another job

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1606

Das Join-Token eines Partners wurde für einen anderen Rang, eine andere Größe, Inkarnation oder einen anderen Host ausgestellt.

Meldung:

the join token is for another rank, size, incarnation or host

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1607

Das Join-Token eines Partners ist missgebildet, oder seine Signatur gilt unter dem öffentlichen Schlüssel des Starters nicht.

Meldung:

the join token is malformed or its signature does not hold

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1608

Ein Frame kündigt mehr Nutzlast an als die Grenze von 16 MiB; er wird abgewiesen, bevor ein Byte der Nutzlast gelesen wird.

Meldung:

the frame is larger than the limit

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1609

Ein Frame gehört zu einer älteren Inkarnation des Jobs; seine Nutzlast wird gelesen und verworfen, und das Warten geht weiter.

Meldung:

the frame is from an older incarnation

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1610

Der Kopf eines Frames bricht eine Regel des Protokolls: ein unbekannter Typ, ein Flag, ein Dienst oder eine Mitgliedschaftsepoche ungleich 0, ein anderer Job, andere Ränge oder eine neuere Inkarnation.

Meldung:

the header of the frame breaks the protocol

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1611

Ein Partner ging verloren: Die Verbindung wurde geschlossen, oder innerhalb der Stillegrenze kam kein Frame.

Meldung:

the peer was lost

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1612

Ein Partner schickte einen Abort-Frame.

Meldung:

the peer aborted the job

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1613

Das Hello eines Partners fehlt, kommt zweimal, hat eine andere Version oder bietet keinen Punkt-zu-Punkt-Dienst an.

Meldung:

the hello of the peer is missing, repeated or not acceptable

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1614

Die Kommandozeile von hilde run oder seine Hostliste ist falsch: eine fehlende oder unbekannte Option, eine Zahl außerhalb des Bereichs, kein Host oder eine Zeile, die kein Host mit Port ist.

Meldung:

the command line or the host list is wrong

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1615

Ein Rang ließ sich nicht starten, oder die Schlüssel, Zertifikate oder Ports des Jobs ließen sich nicht herstellen.

Meldung:

a rank could not be started

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1616

Die Jobbeschreibung, die ein Rang auf der Standardeingabe bekam, ist missgebildet.

Meldung:

the job description is malformed

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1617

Ein Kollektiv-Frame passt nicht zu dem Aufruf, den er beantwortet: andere Operation, anderer Typ, andere Reduktion, Phase, Wurzel oder Folgenummer, oder Beiträge eines gather verschiedener Länge.

Meldung:

the collective frame does not match the call

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1618

Die Argumente eines Kollektiv-Aufrufs sind falsch: eine Wurzel außerhalb des Jobs, ein Elementtyp und eine Reduktion, die nicht zusammenpassen, Daten, die keine ganze Zahl von Elementen oder Blöcken sind, oder Beiträge eines reduce verschiedener Länge.

Meldung:

the arguments of the collective call are wrong

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1619

Eine Checkpoint-Datei hat eine andere Magic oder Version oder einen Job, eine Epoche, einen Rang, eine Größe oder eine Länge, die nicht die erwartete ist, oder sie ist zu kurz.

Meldung:

the checkpoint file is not the one expected

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1620

Das SHA-256 des Zustands in einer Checkpoint-Datei ist nicht das in ihrem Kopf oder nicht das, das die COMMIT-Datei für den Rang aufführt.

Meldung:

the SHA-256 of the checkpoint file does not match

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1621

Eine COMMIT-Datei ist missgebildet, gehört zu einem anderen Job oder einer anderen Epoche, oder ihre CompositeSig-Signatur gilt für den öffentlichen Schlüssel des Jobs nicht. Eine Epoche ohne gültige COMMIT-Datei zählt nicht.

Meldung:

the COMMIT file is malformed or its signature does not hold

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1622

Ein resume fand keine Epoche mit gültiger COMMIT-Datei und allen Rang-Dateien, oder die Ränge einigten sich nicht auf die Epoche.

Meldung:

no epoch can be resumed

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1623

Ein resume wurde für einen Job mit anderer Rangzahl verlangt, als der Checkpoint geschrieben wurde. Version 1 des Formats verlangt dieselbe Größe.

Meldung:

the job has another size than the checkpoint

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1624

Ein Checkpoint wurde verlangt, während auf diesem Rang noch ein send oder receive offen war.

Meldung:

a send or receive is still open

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben

H1625

Ein Checkpoint konnte nicht geschrieben oder gesendet werden, oder es wurde kein Checkpoint-Verzeichnis genannt.

Meldung:

the checkpoint could not be written or sent

Der Katalog gibt für diesen Code kein fehlschlagendes Beispiel.

↑ nach oben