123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960 |
- package checker
- import (
- "fmt"
- "strconv"
- "strings"
- "kumachan/standalone/util/richtext"
- "kumachan/interpreter/lang/common/source"
- )
- const BlockClassError = "error"
- const BlockClassErrorContentItem = "error-content-item"
- func makeErrorDescBlankBlock() richtext.Block {
- var b richtext.Block
- b.AddClass(BlockClassError)
- b.WriteSpan("Error: ", richtext.TAG_EM)
- return b
- }
- func makeErrorDescBlock(msg ...string) richtext.Block {
- var b = makeErrorDescBlankBlock()
- for i, span := range msg {
- b.WriteSpan(span, (func() string {
- if (i % 2) == 0 {
- if strings.HasPrefix(span, "(") && strings.HasSuffix(span, ")") {
- return richtext.TAG_ERR_NOTE
- } else {
- return richtext.TAG_ERR_NORMAL
- }
- } else {
- return richtext.TAG_ERR_INLINE
- }
- })())
- }
- return b
- }
- func makeEmptyErrorContentItemBlock() richtext.Block {
- var b richtext.Block
- b.AddClass(BlockClassErrorContentItem)
- return b
- }
- type ImplError struct {
- Concrete string
- Interface string
- Method string
- }
- func (e ImplError) Describe(problem string) richtext.Block {
- return makeErrorDescBlock (
- "type", e.Concrete, "cannot implement interface", e.Interface,
- ": method", e.Method, "not available:", problem,
- )
- }
- type SizeLimitError struct {
- Given uint
- Limit uint
- }
- func (e SizeLimitError) Describe(which string) richtext.Block {
- return makeErrorDescBlock (
- fmt.Sprintf("%s size limit exceeded (%d/%d)", which, e.Given, e.Limit),
- )
- }
- // ****************************************************************************
- type E_ModuleNotFound struct {
- ModuleName string
- }
- func (e E_ModuleNotFound) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "no such module: ", e.ModuleName,
- )
- }
- type E_BlankTypeDefinition struct {}
- func (E_BlankTypeDefinition) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "blank type definition",
- )
- }
- type E_DuplicateTypeDefinition struct {
- Which string
- }
- func (e E_DuplicateTypeDefinition) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate definition for type", e.Which,
- )
- }
- type E_InvalidMetadata struct {
- Reason string
- }
- func (e E_InvalidMetadata) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- fmt.Sprintf("invalid metadata: %s", e.Reason),
- )
- }
- type E_InvalidTypeName struct {
- Name string
- }
- func (e E_InvalidTypeName) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- fmt.Sprintf("invalid type name: %s", strconv.Quote(e.Name)),
- )
- }
- type E_TypeParametersOnCaseType struct {}
- func (E_TypeParametersOnCaseType) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot specify explicit type parameters on case types",
- )
- }
- type E_TypeNotFound struct {
- Which string
- }
- func (e E_TypeNotFound) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "no such type:", e.Which,
- )
- }
- type E_TypeWrongParameterQuantity struct {
- Which string
- Given uint
- Least uint
- Total uint
- }
- func (e E_TypeWrongParameterQuantity) DescribeError() richtext.Block {
- var arity string
- if e.Least != e.Total {
- arity = fmt.Sprintf("total %d [at least %d]", e.Total, e.Least)
- } else {
- arity = fmt.Sprintf("total %d", e.Total)
- }
- var arity_note = fmt.Sprintf("(%s required but %d given)", arity, e.Given)
- return makeErrorDescBlock (
- "wrong parameter quantity for type", e.Which,
- arity_note,
- )
- }
- type E_TypeDuplicateField struct {
- Which string
- }
- func (e E_TypeDuplicateField) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate field:", e.Which,
- )
- }
- type E_DefaultValuesForNonRecordType struct {}
- func (E_DefaultValuesForNonRecordType) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot define default field values for a non-record type",
- )
- }
- type E_CircularSubtypingDefinition struct {
- Which [] string
- }
- func (e E_CircularSubtypingDefinition) DescribeError() richtext.Block {
- var b = makeErrorDescBlankBlock()
- b.WriteSpan("circular subtyping definition:", richtext.TAG_ERR_NORMAL)
- b.WriteSpan("cycle(s) detected within types:", richtext.TAG_ERR_NORMAL)
- for i, t := range e.Which {
- if i > 0 {
- b.WriteSpan(",", richtext.TAG_ERR_NORMAL)
- }
- b.WriteSpan(t, richtext.TAG_ERR_INLINE)
- }
- return b
- }
- type E_CircularInterfaceDefinition struct {
- Which [] string
- }
- func (e E_CircularInterfaceDefinition) DescribeError() richtext.Block {
- var b = makeErrorDescBlankBlock()
- b.WriteSpan("circular interface definition:", richtext.TAG_ERR_NORMAL)
- b.WriteSpan("cycle(s) detected within types:", richtext.TAG_ERR_NORMAL)
- for i, t := range e.Which {
- if i > 0 {
- b.WriteSpan(",", richtext.TAG_ERR_NORMAL)
- }
- b.WriteSpan(t, richtext.TAG_ERR_INLINE)
- }
- return b
- }
- type E_DuplicateImplemented struct {
- Which string
- }
- func (e E_DuplicateImplemented) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicated implemented type:", e.Which,
- )
- }
- type E_BadImplemented struct {
- Which string
- }
- func (e E_BadImplemented) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "bad implemented type:", e.Which,
- "(should be an interface type)",
- )
- }
- type E_BlankTypeExpr struct {}
- func (E_BlankTypeExpr) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "blank type expression",
- )
- }
- type E_TooManyTypeParameters struct {
- SizeLimitError
- }
- func (e E_TooManyTypeParameters) DescribeError() richtext.Block {
- return e.Describe("type parameter list")
- }
- type E_InvalidVarianceOnParameters struct {
- Which [] string
- }
- func (e E_InvalidVarianceOnParameters) DescribeError() richtext.Block {
- var b = makeErrorDescBlankBlock()
- b.WriteSpan("invalid variance declared on parameters:", richtext.TAG_ERR_NORMAL)
- for i, t := range e.Which {
- if i > 0 {
- b.WriteSpan(",", richtext.TAG_ERR_NORMAL)
- }
- b.WriteSpan(t, richtext.TAG_ERR_INLINE)
- }
- return b
- }
- type E_TooManyImplemented struct {
- SizeLimitError
- }
- func (e E_TooManyImplemented) DescribeError() richtext.Block {
- return e.Describe("implemented type list")
- }
- type E_ImplementedIncompatibleParameters struct {
- TypeName string
- InterfaceName string
- }
- func (e E_ImplementedIncompatibleParameters) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "type", e.TypeName,
- "cannot implement the interface", e.InterfaceName,
- "(parameters incompatible)",
- )
- }
- type E_InvalidFunctionName struct {
- Name string
- }
- func (e E_InvalidFunctionName) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- fmt.Sprintf("invalid function name: %s", strconv.Quote(e.Name)),
- )
- }
- type E_ImplMethodNoSuchFunctionOrField struct {
- ImplError
- }
- func (e E_ImplMethodNoSuchFunctionOrField) DescribeError() richtext.Block {
- return e.Describe("no such function or field")
- }
- type E_ImplMethodNoneCompatible struct {
- ImplError
- }
- func (e E_ImplMethodNoneCompatible) DescribeError() richtext.Block {
- return e.Describe("none of method functions compatible")
- }
- type E_ImplMethodAmbiguous struct {
- ImplError
- }
- func (e E_ImplMethodAmbiguous) DescribeError() richtext.Block {
- return e.Describe(
- "ambiguous method implementation: " +
- "corresponding field and method function both exist",
- )
- }
- type E_ImplMethodDuplicateCompatible struct {
- ImplError
- }
- func (e E_ImplMethodDuplicateCompatible) DescribeError() richtext.Block {
- return e.Describe("multiple method functions compatible")
- }
- type E_ReceiverTypeNotFound struct {
- TypeName string
- }
- func (e E_ReceiverTypeNotFound) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "bad receiver: no such type: ", e.TypeName,
- )
- }
- type E_IntegerNotRepresentableByFloatType struct {}
- func (E_IntegerNotRepresentableByFloatType) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "integer literal is too big to be represented " +
- "using a floating-point type",
- )
- }
- type E_IntegerOverflowUnderflow struct {
- TypeName string
- }
- func (e E_IntegerOverflowUnderflow) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "integer literal is not representable by the type", e.TypeName,
- )
- }
- type E_FloatOverflowUnderflow struct {}
- func (E_FloatOverflowUnderflow) DescribeError() richtext.Block {
- return makeErrorDescBlock("float literal value too big")
- }
- type E_InvalidChar struct {
- Content string
- }
- func (e E_InvalidChar) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "invalid character", e.Content,
- )
- }
- type E_NotAssignable struct {
- From string
- To string
- }
- func (e E_NotAssignable) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "type", e.From,
- "cannot be assigned to the type", e.To,
- )
- }
- type E_TupleSizeNotMatching struct {
- Required uint
- Given uint
- }
- func (e E_TupleSizeNotMatching) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "tuple size not matching: " +
- fmt.Sprintf("%d required but %d given", e.Required, e.Given),
- )
- }
- type E_TupleUnexpectedParallelMark struct {}
- func (E_TupleUnexpectedParallelMark) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "unexpected parallel mark",
- )
- }
- type E_CannotMatchUnit struct {
- TypeName string
- }
- func (e E_CannotMatchUnit) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot match unit from type", e.TypeName,
- )
- }
- type E_CannotMatchTuple struct {
- TypeName string
- }
- func (e E_CannotMatchTuple) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot match tuple from type", e.TypeName,
- )
- }
- type E_CannotMatchRecord struct {
- TypeName string
- }
- func (e E_CannotMatchRecord) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot match record from type", e.TypeName,
- )
- }
- type E_PatternSizeLimitExceeded struct {}
- func (E_PatternSizeLimitExceeded) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "too many bindings in pattern",
- "(binding quantity limit for one pattern exceeded limit)",
- )
- }
- type E_DuplicateBinding struct {
- BindingName string
- }
- func (e E_DuplicateBinding) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate binding", e.BindingName,
- )
- }
- type E_FieldNotFound struct {
- FieldName string
- TypeName string
- }
- func (e E_FieldNotFound) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "field", e.FieldName,
- "does not exist in type", e.TypeName,
- )
- }
- type E_MissingField struct {
- FieldName string
- }
- func (e E_MissingField) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "missing field", e.FieldName,
- )
- }
- type E_ExplicitTypeRequired struct {}
- func (E_ExplicitTypeRequired) DescribeError() richtext.Block {
- return makeErrorDescBlock("explicit type cast expected")
- }
- type E_LambdaAssignedToIncompatible struct {
- TypeName string
- }
- func (e E_LambdaAssignedToIncompatible) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "lambda cannot be assigned to incompatible type", e.TypeName,
- )
- }
- type E_TooManyTupleElements struct {
- SizeLimitError
- }
- func (e E_TooManyTupleElements) DescribeError() richtext.Block {
- return e.Describe("tuple")
- }
- type E_TooManyFormatterInputs struct {
- SizeLimitError
- }
- func (e E_TooManyFormatterInputs) DescribeError() richtext.Block {
- return e.Describe("string formatter input")
- }
- type E_TooManyRecordFields struct {
- SizeLimitError
- }
- func (e E_TooManyRecordFields) DescribeError() richtext.Block {
- return e.Describe("record")
- }
- type E_TooManyEnumCases struct {
- SizeLimitError
- }
- func (e E_TooManyEnumCases) DescribeError() richtext.Block {
- return e.Describe("enum")
- }
- type E_TooManyInterfaceMethods struct {
- SizeLimitError
- }
- func (e E_TooManyInterfaceMethods) DescribeError() richtext.Block {
- return e.Describe("interface")
- }
- type E_DuplicateField struct {
- FieldName string
- }
- func (e E_DuplicateField) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate field", e.FieldName,
- )
- }
- type E_UpdateOnNonRecord struct {
- TypeName string
- }
- func (e E_UpdateOnNonRecord) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot perform update operation on non-record type", e.TypeName,
- )
- }
- type E_NoSuchFieldOrMethod struct {
- FieldName string
- TypeName string
- }
- func (e E_NoSuchFieldOrMethod) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "field or method", e.FieldName,
- "does not exist on type", e.TypeName)
- }
- type E_NoSuchFieldOrCase struct {
- FieldName string
- TypeName string
- }
- func (e E_NoSuchFieldOrCase) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "field or case", e.FieldName,
- "does not exist on type", e.TypeName)
- }
- type E_RecordSizeNotMatching struct {
- Given uint
- Required uint
- }
- func (e E_RecordSizeNotMatching) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "record size not matching: " +
- fmt.Sprintf("%d required but %d given", e.Required, e.Given),
- )
- }
- type E_TypeNotCallable struct {
- TypeName string
- }
- func (e E_TypeNotCallable) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "type", e.TypeName,
- "is not callable",
- )
- }
- type E_NonLambdaRecursive struct {}
- func (E_NonLambdaRecursive) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "non-lambda expression cannot be declared recursive",
- )
- }
- type E_NoSuchBindingOrFunction struct {
- Name string
- Pivot string
- }
- func (e E_NoSuchBindingOrFunction) DescribeError() richtext.Block {
- if e.Pivot == "" {
- return makeErrorDescBlock (
- "no such binding or function: ", e.Name,
- )
- } else {
- return makeErrorDescBlock (
- "no such binding or function: ", e.Name,
- fmt.Sprintf("(in the module of the type %s)", e.Pivot),
- )
- }
- }
- type E_ImplicitContextNotFound struct {
- InnerError richtext.Block
- }
- func (e E_ImplicitContextNotFound) DescribeError() richtext.Block {
- var b = makeErrorDescBlankBlock()
- b.WriteSpan("implicit context not available: ", richtext.TAG_ERR_NORMAL)
- b.Append(e.InnerError)
- return b
- }
- type E_InvalidFunctionUsage struct {
- Candidates [] OverloadCandidateInfo
- }
- type OverloadCandidateInfo struct {
- Name string
- Signature string
- Error *source.Error
- }
- func (e E_InvalidFunctionUsage) DescribeError() richtext.Block {
- var b = makeErrorDescBlankBlock()
- b.WriteLine(
- "none of functions can be called/assigned:",
- richtext.TAG_ERR_NORMAL)
- for _, candidate := range e.Candidates {
- var item = makeEmptyErrorContentItemBlock()
- var title = fmt.Sprintf("%s: %s", candidate.Name, candidate.Signature)
- item.WriteLine(title, richtext.TAG_ERR_NOTE)
- item.Append(candidate.Error.Message())
- b.Append(item)
- }
- return b
- }
- type E_AmbiguousFunctionUsage struct {
- Options [] OverloadOptionInfo
- }
- type OverloadOptionInfo struct {
- Name string
- Signature string
- }
- func (e E_AmbiguousFunctionUsage) DescribeError() richtext.Block {
- var b = makeErrorDescBlankBlock()
- b.WriteLine(
- "callee/assignee not decidable within functions:",
- richtext.TAG_ERR_NORMAL)
- for _, option := range e.Options {
- var item = makeEmptyErrorContentItemBlock()
- var item_text = fmt.Sprintf("%s: %s", option.Name, option.Signature)
- item.WriteLine(item_text, richtext.TAG_ERR_NOTE)
- b.Append(item)
- }
- return b
- }
- type E_TypeParametersOnLocalBindingRef struct {}
- func (E_TypeParametersOnLocalBindingRef) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot specify type parameters on a local binding reference",
- )
- }
- type E_TypeParametersExceededArity struct {
- Arity uint
- }
- func (e E_TypeParametersExceededArity) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "the quantity of specified type parameters exceeded " +
- fmt.Sprintf("the arity (%d)", e.Arity),
- )
- }
- type E_InvalidTypeParameter struct {
- Index uint
- Name string
- }
- func (e E_InvalidTypeParameter) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "invalid type specified for type parameter",
- fmt.Sprintf("%s (#%d)", e.Name, e.Index),
- )
- }
- type E_TypeParameterNotInferred struct {
- Index uint
- Name string
- }
- func (e E_TypeParameterNotInferred) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "type parameter", fmt.Sprintf("%s (#%d)", e.Name, e.Index),
- "cannot be automatically inferred",
- "(explicit type parameters required)",
- )
- }
- type E_SwitchOnNonEnum struct {}
- func (E_SwitchOnNonEnum) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot switch on a non-enum value",
- )
- }
- type E_DuplicateCase struct {}
- func (E_DuplicateCase) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate case",
- )
- }
- type E_NoSuchCase struct {
- Case string
- }
- func (e E_NoSuchCase) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "no such case:", e.Case,
- )
- }
- type E_CondNotExhaustive struct {}
- func (E_CondNotExhaustive) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "conditional branches not exhaustive",
- )
- }
- type E_SelectTooManyArguments struct {}
- func (E_SelectTooManyArguments) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "too many arguments for a select expression",
- )
- }
- type E_SelectInsufficientArguments struct {}
- func (E_SelectInsufficientArguments) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "argument quantity not enough for a select expression",
- )
- }
- type E_SelectOverlappingBranches struct {}
- func (E_SelectOverlappingBranches) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "overlapping branches detected")
- }
- type E_RedundantTypeParameters struct {}
- func (E_RedundantTypeParameters) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "redundant type parameters",
- )
- }
- type E_BoxIntoProtected struct {
- TypeName string
- CtxModName string
- }
- func (e E_BoxIntoProtected) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot box a value into the protected box type", e.TypeName,
- "under the context of module", e.CtxModName,
- )
- }
- type E_BoxIntoOpaque struct {
- TypeName string
- CtxModName string
- }
- func (e E_BoxIntoOpaque) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot box a value into the opaque box type", e.TypeName,
- "under the context of module", e.CtxModName,
- )
- }
- type E_InvalidConstructorCall struct {}
- func (E_InvalidConstructorCall) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "invalid constructor call",
- )
- }
- type E_InvalidConstructor struct {}
- func (E_InvalidConstructor) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "invalid constructor",
- )
- }
- type E_NotImplementation struct {
- Type string
- Interface string
- }
- func (e E_NotImplementation) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "type", e.Type,
- "is not an implementation of the interface", e.Interface,
- )
- }
- type E_DynamicCastFromNonInterface struct {
- Type string
- }
- func (e E_DynamicCastFromNonInterface) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot dynamically cast from non-interface type",
- e.Type,
- )
- }
- type E_DynamicCastToInterface struct {}
- func (E_DynamicCastToInterface) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "cannot dynamically cast to interface type: unsupported feature",
- )
- }
- type E_BlankTerm struct {}
- func (E_BlankTerm) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "expression expected",
- )
- }
- type E_NotSerializable struct {
- TypeName string
- }
- func (e E_NotSerializable) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "type", e.TypeName,
- "is not serializable",
- )
- }
- type E_DuplicateVdTypeId struct {
- Id string
- }
- func (e E_DuplicateVdTypeId) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate assignment of type id", e.Id,
- )
- }
- type E_GenericTypeDeclaredSerializable struct {
- TypeDefName string
- }
- func (e E_GenericTypeDeclaredSerializable) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "type", e.TypeDefName,
- "cannot be serializable",
- "(interface and native type cannot be declared serializable)",
- )
- }
- type E_EnumCaseNotSerializable struct {
- Case string
- }
- func (e E_EnumCaseNotSerializable) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "case", e.Case,
- "must be declared serializable for the enum to be serializable",
- )
- }
- type E_InvalidValidator struct {}
- func (E_InvalidValidator) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "invalid validator",
- )
- }
- type E_DuplicateValidator struct {}
- func (E_DuplicateValidator) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate validator",
- )
- }
- type E_InvalidAdapter struct {}
- func (E_InvalidAdapter) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "invalid adapter",
- )
- }
- type E_DuplicateAdapter struct {}
- func (E_DuplicateAdapter) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate adapter",
- )
- }
- type E_MissingValidator struct {
- TypeDefName string
- }
- func (e E_MissingValidator) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "missing validator for type", e.TypeDefName,
- )
- }
- type E_DuplicateServiceIdentifier struct {
- ServiceIdentifier string
- }
- func (e E_DuplicateServiceIdentifier) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate assignment of service id", e.ServiceIdentifier,
- )
- }
- type E_ServiceNotInterface struct {}
- func (E_ServiceNotInterface) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "a service type must be an interface type",
- )
- }
- type E_GenericService struct {}
- func (E_GenericService) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "a service interface type cannot be generic",
- )
- }
- type E_ServiceWithBaseInterface struct {}
- func (e E_ServiceWithBaseInterface) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "a service interface type cannot have base interfaces",
- )
- }
- type E_ServiceInvalidMethodType struct {
- TypeName string
- }
- func (e E_ServiceInvalidMethodType) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "invalid service method type", e.TypeName,
- "(output should be Observable[DATA,Error] or Async[DATA,Error])",
- )
- }
- type E_ServiceMissingConstructorArgumentType struct {
- TypeDefName string
- }
- func (e E_ServiceMissingConstructorArgumentType) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "missing corresponding constructor argument type for the service type",
- e.TypeDefName,
- )
- }
- type E_ServiceDuplicateConstructor struct {
- TypeDefName string
- }
- func (e E_ServiceDuplicateConstructor) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate service constructor for type", e.TypeDefName,
- )
- }
- type E_SelfRefBindingOnTopLevel struct {}
- func (E_SelfRefBindingOnTopLevel) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "self-reference binding is NOT supported on top-level functions",
- )
- }
- type E_InvalidAsset struct {
- Error error
- }
- func (e E_InvalidAsset) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- fmt.Sprintf("invalid asset: %s", e.Error.Error()),
- )
- }
- type E_WrongAssetType struct {
- Extension string
- Required string
- }
- func (e E_WrongAssetType) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- fmt.Sprintf("type for [%s] asset should be", e.Extension),
- e.Required,
- )
- }
- type E_DuplicateEntryEffect struct {}
- func (E_DuplicateEntryEffect) DescribeError() richtext.Block {
- return makeErrorDescBlock (
- "duplicate entry effect",
- )
- }
|