blob: 6a9d07e87788d347e4f142fa77db0695235b7479 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
implementation module Sil.Error
import StdFile
import StdString
import Text
import Sil.Syntax
import Sil.Types
instance toString Error
where
toString (P_Invalid loc sym) = "Invalid token '" <+ sym <+ "' while parsing a " <+ loc <+ "."
toString (P_Expected s) = "Expected " <+ s <+ "."
toString (T_IllegalApplication ft et) = "Cannot apply a " <+ et <+ " to a " <+ ft <+ "."
toString (T_IllegalField f t) = "Illegal field '" <+ f <+ "' on type " <+ t <+ "."
toString (T_TooHighTupleArity i) = "Too high tuple arity " <+ i <+ " (maximum is 32)."
toString (C_UndefinedName n) = "Undefined name '" <+ n <+ "'."
toString (C_UndefinedField f) = "Undefined field '" <+ f <+ "'."
toString C_VariableLabel = "Variable stored at label."
toString C_FunctionOnStack = "Function stored on the stack."
toString (C_TypeError err e) = "Type error in '" <+ e <+ "': " <+ err
toString (C_CouldNotDeduceType e) = "Could not deduce type of '" <+ e <+ "'."
toString (C_TypeMisMatch t e) = "Type mismatch: expected " <+ t <+ " for '" <+ e <+ "'."
toString (C_BasicInitWithoutValue n) = "Basic value '" <+ n <+ "' must have an initial value."
toString (UnknownError e) = "Unknown error: " <+ e <+ "."
instance <<< Error where <<< f e = f <<< toString e <<< "\r\n"
|