Skip to content

Instantly share code, notes, and snippets.

@mpictor
Created November 5, 2011 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpictor/1340953 to your computer and use it in GitHub Desktop.
Save mpictor/1340953 to your computer and use it in GitHub Desktop.
Return type or local variable requires type label
# parser output for line 94 of file below
# $ ../bin/fedex_plus -d9 -l94 -u94 ../../test/test_generics_type_label.exp
Schema line number: 94
Next token is token TOK_IDENTIFIER ()
Shifting token TOK_IDENTIFIER ()
Entering state 117
Reducing stack by rule 147 (line 1135):
$1 = token TOK_IDENTIFIER ()
-> $$ = nterm id_list ()
Stack now 0 2 9 13 21 50 71 119
Entering state 118
Reading a token: Next token is token TOK_COLON ()
Shifting token TOK_COLON ()
Entering state 209
Reading a token: Next token is token TOK_LIST ()
Shifting token TOK_LIST ()
Entering state 332
Reading a token: Next token is token TOK_OF ()
Shifting token TOK_OF ()
Entering state 448
Reading a token: Next token is token TOK_GENERIC ()
Reducing stack by rule 310 (line 1913):
-> $$ = nterm unique ()
Stack now 0 2 9 13 21 50 71 119 118 209 332 448
Entering state 521
Next token is token TOK_GENERIC ()
Shifting token TOK_GENERIC ()
Entering state 331
Reading a token: Next token is token TOK_ASSIGNMENT ()
Reducing stack by rule 145 (line 1116):
$1 = token TOK_GENERIC ()
../../test/test_generics_type_label.exp:94: --ERROR: Return type or local variable requires type label in `validate_dependently_instantiable_entity_data_types'
-> $$ = nterm generic_type ()
Stack now 0 2 9 13 21 50 71 119 118 209 332 448 521
Entering state 338
Reducing stack by rule 127 (line 1024):
$1 = nterm generic_type ()
-> $$ = nterm parameter_type ()
Stack now 0 2 9 13 21 50 71 119 118 209 332 448 521
Entering state 573
Reducing stack by rule 141 (line 1096):
$1 = token TOK_LIST ()
$2 = token TOK_OF ()
$3 = nterm unique ()
$4 = nterm parameter_type ()
-> $$ = nterm conformant_aggregation ()
Stack now 0 2 9 13 21 50 71 119 118 209
Entering state 337
Reducing stack by rule 125 (line 1019):
$1 = nterm conformant_aggregation ()
-> $$ = nterm parameter_type ()
Stack now 0 2 9 13 21 50 71 119 118 209
Entering state 336
Next token is token TOK_ASSIGNMENT ()
Shifting token TOK_ASSIGNMENT ()
Entering state 452
Reading a token: Next token is token TOK_LEFT_BRACKET ()
Shifting token TOK_LEFT_BRACKET ()
Entering state 176
Reading a token: Next token is token TOK_RIGHT_BRACKET ()
Shifting token TOK_RIGHT_BRACKET ()
Entering state 275
Reducing stack by rule 9 (line 441):
$1 = token TOK_LEFT_BRACKET ()
$2 = token TOK_RIGHT_BRACKET ()
-> $$ = nterm aggregate_initializer ()
Stack now 0 2 9 13 21 50 71 119 118 209 336 452
Entering state 190
Reducing stack by rule 299 (line 1879):
$1 = nterm aggregate_initializer ()
-> $$ = nterm unary_expression ()
Stack now 0 2 9 13 21 50 71 119 118 209 336 452
Entering state 200
Reading a token: Next token is token TOK_SEMICOLON ()
Reducing stack by rule 106 (line 926):
$1 = nterm unary_expression ()
-> $$ = nterm simple_expression ()
Stack now 0 2 9 13 21 50 71 119 118 209 336 452
Entering state 193
Next token is token TOK_SEMICOLON ()
Reducing stack by rule 91 (line 876):
$1 = nterm simple_expression ()
-> $$ = nterm expression ()
Stack now 0 2 9 13 21 50 71 119 118 209 336 452
Entering state 525
Next token is token TOK_SEMICOLON ()
Reducing stack by rule 194 (line 1378):
$1 = token TOK_ASSIGNMENT ()
$2 = nterm expression ()
-> $$ = nterm local_initializer ()
Stack now 0 2 9 13 21 50 71 119 118 209 336
Entering state 453
Next token is token TOK_SEMICOLON ()
Shifting token TOK_SEMICOLON ()
Entering state 15
Reducing stack by rule 254 (line 1713):
$1 = token TOK_SEMICOLON ()
-> $$ = nterm semicolon ()
Stack now 0 2 9 13 21 50 71 119 118 209 336 453
Entering state 526
Reducing stack by rule 196 (line 1392):
$1 = nterm id_list ()
$2 = token TOK_COLON ()
$3 = nterm parameter_type ()
$4 = nterm local_initializer ()
$5 = nterm semicolon ()
-> $$ = nterm local_variable ()
Stack now 0 2 9 13 21 50 71 119
Entering state 119
Reading a token:
Schema line number 95 > upper limit. yydebug = 0.
../../test/test_generics_type_label.exp:96: --ERROR: Return type or local variable requires type label in `validate_dependently_instantiable_entity_data_types'
Errors in input
SCHEMA test_generics_type_label;
CONSTANT
schema_prefix : STRING := 'test_generics_type_label.';
END_CONSTANT;
FUNCTION remove_first(alist : LIST OF GENERIC:GEN) : LIST OF GENERIC:GEN;
LOCAL
blist : LIST OF GENERIC := alist;
END_LOCAL;
IF SIZEOF (blist) > 0 THEN
REMOVE (blist, 1);
END_IF;
RETURN (blist);
END_FUNCTION; -- remove_first
ENTITY variable_semantics
ABSTRACT SUPERTYPE;
END_ENTITY;
ENTITY environment;
syntactic_representation: generic_variable;
semantics: variable_semantics;
END_ENTITY;
ENTITY abstracted_expression_function
SUBTYPE OF (maths_function, quantifier_expression);
DERIVE
SELF\quantifier_expression.variables : LIST [1:?] OF UNIQUE generic_variable :=
remove_first(SELF\multiple_arity_generic_expression.operands);
expr : generic_expression := SELF\multiple_arity_generic_expression.operands[1];
WHERE
WR1: SIZEOF (QUERY ( operand <*
SELF\multiple_arity_generic_expression.operands | NOT (
has_values_space( operand)))) = 0;
END_ENTITY;
ENTITY maths_function
ABSTRACT SUPERTYPE OF ( ABSTRACTED_EXPRESSION_FUNCTION )
SUBTYPE OF (generic_expression);
END_ENTITY;
ENTITY quantifier_expression
ABSTRACT SUPERTYPE
SUBTYPE OF (multiple_arity_generic_expression);
variables : LIST [1:?] OF UNIQUE generic_variable;
WHERE
WR1: SIZEOF (QUERY (vrbl <* variables | NOT (vrbl IN
SELF\multiple_arity_generic_expression.operands))) = 0;
WR2: SIZEOF (QUERY (vrbl <* variables | NOT ((schema_prefix +
'BOUND_VARIABLE_SEMANTICS') IN TYPEOF (vrbl.interpretation.semantics)))) = 0;
END_ENTITY;
ENTITY multiple_arity_generic_expression
ABSTRACT SUPERTYPE
SUBTYPE OF(generic_expression);
operands: LIST [2:?] OF generic_expression;
END_ENTITY;
ENTITY generic_expression
ABSTRACT SUPERTYPE OF (ONEOF (
SIMPLE_GENERIC_EXPRESSION,
MULTIPLE_ARITY_GENERIC_EXPRESSION));
END_ENTITY;
ENTITY simple_generic_expression
ABSTRACT SUPERTYPE OF (ONEOF (
GENERIC_LITERAL,
GENERIC_VARIABLE))
SUBTYPE OF (generic_expression);
END_ENTITY;
ENTITY generic_literal
ABSTRACT SUPERTYPE
SUBTYPE OF (simple_generic_expression);
END_ENTITY;
ENTITY generic_variable
ABSTRACT SUPERTYPE
SUBTYPE OF (simple_generic_expression);
INVERSE
interpretation :
environment FOR syntactic_representation;
END_ENTITY;
FUNCTION has_values_space(expr : generic_expression) : BOOLEAN;
LOCAL
typenames : SET OF STRING := stripped_typeof (expr);
END_LOCAL;
IF 'EXPRESSION' IN typenames THEN
RETURN (bool(('NUMERIC_EXPRESSION' IN typenames) OR
('STRING_EXPRESSION' IN typenames) OR
('BOOLEAN_EXPRESSION' IN typenames)));
END_IF;
IF 'MATHS_FUNCTION' IN typenames THEN
RETURN (TRUE);
END_IF;
RETURN (FALSE);
END_FUNCTION;
FUNCTION stripped_typeof(arg : GENERIC:G) : SET OF STRING;
LOCAL
types : SET OF STRING := TYPEOF (arg);
stypes : SET OF STRING := [];
n : INTEGER := LENGTH (schema_prefix);
END_LOCAL;
REPEAT i := 1 TO SIZEOF (types);
IF types[i][1:n] = schema_prefix THEN
stypes := stypes + types[i][n+1:LENGTH(types[i])];
ELSE
stypes := stypes + types[i];
END_IF;
END_REPEAT;
RETURN (stypes);
END_FUNCTION; -- stripped_typeof
FUNCTION bool(lgcl: LOGICAL) : BOOLEAN;
IF NOT EXISTS (lgcl) THEN RETURN (FALSE); END_IF;
IF lgcl <> TRUE THEN RETURN (FALSE); END_IF;
RETURN (TRUE);
END_FUNCTION; -- bool
END_SCHEMA;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment