overload resolution for proc vars

This commit is contained in:
Andreas Rumpf
2009-06-24 17:13:22 +02:00
parent 36818817bd
commit 300430fbba
56 changed files with 2772 additions and 2430 deletions

View File

@@ -8,7 +8,7 @@
#
{
'SymFlag': [ # already 28 flags!
'SymFlag': [ # already 29 flags!
'sfUsed', # read access of sym (for warnings) or simply used
'sfStar', # symbol has * visibility
'sfMinus', # symbol has - visibility
@@ -27,6 +27,7 @@
'sfResult', # variable is 'result' in proc
'sfNoSideEffect', # proc has no side effects
'sfSideEffect', # proc may have side effects; cannot prove it has none
'sfMainModule', # module is the main module
'sfSystemModule', # module is the system module
'sfNoReturn', # proc never returns (an exit proc)
@@ -47,6 +48,7 @@
'TypeFlag': [
'tfVarargs', # procedure has C styled varargs
'tfNoSideEffect', # procedure type does not allow side effects
'tfFinal', # is the object final?
'tfAcyclic', # type is acyclic (for GC optimization)
'tfEnumHasWholes' # enum cannot be mapped into a range
@@ -146,10 +148,11 @@
'nkElseExpr',
'nkLambda', # lambda expression
'nkAccQuoted', # `a` as a node
'nkHeaderQuoted', # `a(x: int)` as a node
'nkTableConstr', # a table constructor {expr: expr}
'nkQualified', # describes a.b for qualified identifiers
'nkBind', # ``bind expr`` node
'nkSymChoice', # symbol choice node
'nkHiddenStdConv', # an implicit standard type conversion
'nkHiddenSubConv', # an implicit type conversion from a subtype
# to a supertype

View File

@@ -1,8 +1,8 @@
abstract addr and as asm
block break
bind block break
case cast const continue converter
discard div
elif else end enum except exception
elif else end enum except
finally for from generic
if implies import in include is isnot iterator
lambda

View File

@@ -36,19 +36,15 @@
{'errNoneSpeedOrSizeExpected': "'none', 'speed' or 'size' expected"},
{'errInvalidPragma': 'invalid pragma'},
{'errUnknownPragma': "unknown pragma: '$1'"},
{'errPragmaXHereNotAllowed': "pragma '$1' here not allowed"},
{'errUnknownDirective': "unknown directive: '$1'"},
{'errInvalidDirective': 'invalid directive'},
{'errAtPopWithoutPush': "'pop' without a 'push' pragma"},
{'errEmptyAsm': 'empty asm statement makes no sense'},
{'errAsgnInvalidInExpr': "'=' invalid in an expression; probably '==' meant"},
{'errInvalidIndentation': 'invalid indentation'},
{'errExceptionExpected': 'exception expected'},
{'errExceptionAlreadyHandled': 'exception already handled'},
{'errReturnNotAllowedHere': "'return' only allowed in routine"},
{'errYieldNotAllowedHere': "'yield' only allowed in a loop of an iterator"},
{'errInvalidNumberOfYieldExpr': "invalid number of 'yield' expresions"},
{'errReturnInvalidInIterator': "'return' not allowed in iterator"},
{'errCannotReturnExpr': 'current routine cannot return an expression'},
{'errAttemptToRedefine': "attempt to redefine '$1'"},
{'errStmtInvalidAfterReturn':
@@ -78,21 +74,18 @@
{'errColonOrEqualsExpected': "':' or '=' expected, but found '$1'"},
{'errExprExpected': "expression expected, but found '$1'"},
{'errUndeclaredIdentifier': "undeclared identifier: '$1'"},
{'errUseQualifier': "ambigious identifier: '$1' -- use a qualifier"},
{'errTwiceForwarded': "'$1' is forwarded twice"},
{'errUseQualifier': "ambiguous identifier: '$1' -- use a qualifier"},
{'errTypeExpected': 'type expected'},
{'errSystemNeeds': "system module needs '$1'"},
{'errExecutionOfProgramFailed': 'execution of an external program failed'},
{'errNotOverloadable': "overloaded '$1' leads to ambigious calls"},
{'errNotOverloadable': "overloaded '$1' leads to ambiguous calls"},
{'errInvalidArgForX': "invalid argument for '$1'"},
{'errStmtHasNoEffect': 'statement has no effect'},
{'errXExpectsTypeOrValue': "'$1' expects a type or value"},
{'errXExpectsArrayType': "'$1' expects an array type"},
{'errIteratorCannotBeInstantiated':
"'$1' cannot be instantiated because its body has not been compiled yet"},
{'errExprWithNoTypeCannotBeConverted':
'expression with no type cannot be converted'},
{'errExprWithNoTypeCannotBeCasted': 'expression with no type cannot be casted'},
{'errExprXAmbiguous': "expression '$1' ambiguous in this context"},
{'errConstantDivisionByZero': 'constant division by zero'},
{'errOrdinalTypeExpected': 'ordinal type expected'},
{'errOrdinalOrFloatTypeExpected': 'ordinal or float type expected'},
@@ -112,21 +105,17 @@
{'errValueOutOfSetBounds': 'value out of set bounds'},
{'errFieldInitTwice': "field initialized twice: '$1'"},
{'errFieldNotInit': "field '$1' not initialized"},
{'errExprCannotBeCalled': 'expression cannot be called'},
{'errExprXCannotBeCalled': "expression '$1' cannot be called"},
{'errExprHasNoType': 'expression has no type'},
{'errExprXHasNoType': "expression '$1' has no type"},
{'errExprXHasNoType': "expression '$1' has no type (or is ambiguous)"},
{'errCastNotInSafeMode': "'cast' not allowed in safe mode"},
{'errExprCannotBeCastedToX': 'expression cannot be casted to $1'},
{'errUndefinedPrefixOpr': 'undefined prefix operator: $1'},
{'errCommaOrParRiExpected': "',' or ')' expected"},
{'errCurlyLeOrParLeExpected': "'{' or '(' expected"},
{'errSectionExpected': "section ('type', 'proc', etc.) expected"},
{'errImplemenationExpected': "'implementation' or end of file expected"},
{'errRangeExpected': 'range expected'},
{'errInvalidTypeDescription': 'invalid type description'},
{'errAttemptToRedefineX': "attempt to redefine '$1'"},
{'errMagicOnlyInSystem': "'magic' only allowed in system module"},
{'errUnknownOperatorX': "unkown operator: '$1'"},
{'errPowerOfTwoExpected': 'power of two expected'},
{'errStringMayNotBeEmpty': 'string literal may not be empty'},
{'errCallConvExpected': 'calling convention expected'},
@@ -165,9 +154,8 @@
{'errTypeMismatch': 'type mismatch: got ('},
{'errButExpected': 'but expected one of: '},
{'errButExpectedX': "but expected '$1'"},
{'errAmbigiousCallXYZ': 'ambigious call; both $1 and $2 match for: $3'},
{'errAmbiguousCallXYZ': 'ambiguous call; both $1 and $2 match for: $3'},
{'errWrongNumberOfTypeParams': 'wrong number of type parameters'},
{'errOutParamNoDefaultValue': 'out parameters cannot have default values'},
{'errInlineProcHasNoAddress': 'an inline proc has no address'},
{'errXCannotBeInParamDecl': '$1 cannot be declared in parameter declaration'},
{'errPragmaOnlyInHeaderOfProc':
@@ -177,22 +165,15 @@
{'errNoSymbolToBorrowFromFound': "no symbol to borrow from found"},
{'errDiscardValue': 'value returned by statement has to be discarded'},
{'errInvalidDiscard': 'statement returns no value that can be discarded'},
{'errUnknownPrecedence':
"unknown precedence for operator; use 'infix: prec' pragma"},
{'errIllegalConvFromXtoY': 'conversion from $1 to $2 is invalid'},
{'errTypeMismatchExpectedXGotY': "type mismatch: expected '$1', but got '$2'"},
{'errCannotBindXTwice': "cannot bind parameter '$1' twice"},
{'errInvalidOrderInEnumX': "invalid order in enum '$1'"},
{'errEnumXHasWholes': "enum '$1' has wholes"},
{'errExceptExpected': "'except' or 'finally' expected"},
{'errInvalidTry': "after catch all 'except' or 'finally' no section may follow"},
{'errEofExpectedButXFound': "end of file expected, but found token '$1'"},
{'errOptionExpected': "option expected, but found '$1'"},
{'errCannotEvaluateForwardConst': 'cannot evaluate forwarded constant'},
{'errXisNoLabel': "'$1' is not a label"},
{'errXNeedsConcreteType': "'$1' needs to be of a non-generic type"},
{'errNotAllCasesCovered': 'not all cases are covered'},
{'errStringRange': 'string range in case statement not allowed'},
{'errUnkownSubstitionVar': "unknown substitution variable: '$1'"},
{'errComplexStmtRequiresInd': 'complex statement requires indentation'},
{'errXisNotCallable': "'$1' is not callable"},
@@ -204,7 +185,7 @@
{'errNoReturnTypeForX': 'no return type for $1 allowed'},
{'errConvNeedsOneArg': 'a type conversion needs exactly one argument'},
{'errInvalidPragmaX': 'invalid pragma: $1'},
{'errXNotAllowedHere': '$1 here not allowed'},
{'errXNotAllowedHere': '$1 not allowed here'},
{'errInvalidControlFlowX': 'invalid control flow: $1'},
{'errATypeHasNoValue': 'a type has no value'},
{'errXisNoType': "invalid type: '$1'"},
@@ -214,11 +195,11 @@
{'errInvalidExpressionX': "invalid expression: '$1'"},
{'errEnumHasNoValueX': "enum has no value '$1'"},
{'errNamedExprExpected': 'named expression expected'},
{'errNamedExprNotAllowed': 'named expression here not allowed'},
{'errNamedExprNotAllowed': 'named expression not allowed here'},
{'errXExpectsOneTypeParam': "'$1' expects one type parameter"},
{'errArrayExpectsTwoTypeParams': 'array expects two type parameters'},
{'errInvalidVisibilityX': "invalid invisibility: '$1'"},
{'errInitHereNotAllowed': 'initialization here not allowed'},
{'errInitHereNotAllowed': 'initialization not allowed here'},
{'errXCannotBeAssignedTo': "'$1' cannot be assigned to"},
{'errIteratorNotAllowed':
"iterators can only be defined at the module's top level"},
@@ -254,6 +235,7 @@
{'errUnhandledExceptionX': "unhandled exception: $1"},
{'errCyclicTree': "macro returned a cyclic abstract syntax tree"},
{'errXisNoMacroOrTemplate': "'$1' is no macro or template"},
{'errXhasSideEffects': "'$1' can have side effects"},
# user error message:
{'errUser': '$1'},