{"record":{"id":"38821c764516116d","repo":"mono/mono","slug":"s-w-line-d-of-s-the-default-action-assign","errorCode":null,"errorMessage":"%s: w - line %d of \"%s\", the default action assigns an undefined value to $$\n","messagePattern":"(.+?): w - line (.+?) of \"(.+?)\", the default action assigns an undefined value to \\$\\$\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mcs/jay/error.c","lineNumber":280,"sourceCode":"untyped_rhs (int i,  const char *s)\n{\n    fprintf(stderr, \"%s: w - line %d of \\\"%s\\\", $%d (%s) is untyped\\n\",\n\t    myname, lineno, input_file_name, i, s);\n    /** done(1); */\n}\n\nvoid\nunknown_rhs (int i)\n{\n    fprintf(stderr, \"%s: e - line %d of \\\"%s\\\", $%d is untyped\\n\",\n\t    myname, lineno, input_file_name, i);\n    done(1);\n}\n\nvoid\ndefault_action_warning (void)\n{\n    fprintf(stderr, \"%s: w - line %d of \\\"%s\\\", the default action assigns an \\\nundefined value to $$\\n\", myname, lineno, input_file_name);\n}\n\nvoid\nundefined_goal (const char *s)\n{\n    fprintf(stderr, \"%s: e - the start symbol %s is undefined\\n\", myname, s);\n    done(1);\n}\n\nvoid\nundefined_symbol_warning (const char *s)\n{\n    fprintf(stderr, \"%s: w - the symbol %s is undefined\\n\", myname, s);\n}\n","sourceCodeStart":262,"sourceCodeEnd":296,"githubUrl":"https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mcs/jay/error.c#L262-L296","documentation":"Emitted by default_action_warning() in mcs/jay/error.c:280, reached from end_rule() (reader.c:978) when a rule's LHS has a declared tag, the rule has no explicit action, and the first RHS symbol's tag is null or differs from the LHS tag. jay's implicit default action is `$$ = $1`; when the types mismatch that assignment is undefined, hence the warning (no done()).","triggerScenarios":"A production with a typed LHS but no `{ ... }` action, where the first RHS symbol is either untyped or typed differently.","commonSituations":"Writing a shorthand production `expr : '(' expr ')' ;` intending `$$ = $2` but relying on the default `$$ = $1`; omitting an action on a rule whose LHS expects a specific type.","solutions":["Add an explicit action that assigns the correct value to `$$`, e.g. `{ $$ = $2; }`.","Align the first RHS symbol's %type tag with the LHS tag if the default `$$ = $1` is intended.","If the LHS truly needs no value, remove its %type declaration."],"exampleFix":"// before\n%type <int> expr\n%%\nexpr : '(' expr ')' ;   /* default $$ = $1 where $1 is '(' literal -> default_action_warning */\n// after\nexpr : '(' expr ')' { $$ = $2; }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give an explicit action `{ $$ = $k; }` to any typed-LHS rule, rather than relying on the default.","If using the default, ensure the first RHS symbol's %type tag matches the LHS tag.","Watch literal-token-first productions like `'(' x ')'`, which need `{ $$ = $2; }`."],"tags":["jay","grammar","action","types","default-action"],"backgroundTag":null,"analyzedSha":"0f53e9e151d92944cacab3e24ac359410c606df6","analyzedAt":"2026-08-13T18:54:37.190Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}