mono/mono · warning

%s: w - line %d of "%s", $%d (%s) is untyped

Error message

%s: w - line %d of "%s", $%d (%s) is untyped

What it means

Emitted by untyped_rhs() in mcs/jay/error.c:264, reached from copy_action() (reader.c:1146) when a positional `$N` references an RHS symbol that has no declared tag while tags are in use elsewhere (ntags>0). It is a warning (done() commented out); jay still emits the untyped yyVals reference, risking a runtime cast/boxing issue.

Source

Thrown at mcs/jay/error.c:264

{
    fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n",
	    myname, a_lineno, input_file_name);
    print_pos(a_line, a_cptr);
    done(1);
}

void
untyped_lhs (void)
{
    fprintf(stderr, "%s: w - line %d of \"%s\", $$ is untyped\n",
	    myname, lineno, input_file_name);
    /** done(1); */
}

void
untyped_rhs (int i,  const char *s)
{
    fprintf(stderr, "%s: w - line %d of \"%s\", $%d (%s) is untyped\n",
	    myname, lineno, input_file_name, i, s);
    /** done(1); */
}

void
unknown_rhs (int i)
{
    fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n",
	    myname, lineno, input_file_name, i);
    done(1);
}

void
default_action_warning (void)
{
    fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \
undefined value to $$\n", myname, lineno, input_file_name);
}

View on GitHub (pinned to 0f53e9e151)

Solutions

  1. Declare the symbol's type, e.g. `%type <Tag> name` or `%token <Tag> name`.
  2. If the referenced symbol is a valueless literal token, do not read `$N` for it; renumber subsequent references.
  3. Audit all `%type`/`%token <Tag>` declarations against the symbols you dereference.

Example fix

// before
%type <int> num
%%
expr : num op num { $$ = $1 + $3; }  /* op untyped -> untyped_rhs(2,op) */
// after
%type <int> num
%token op   /* op carries no value; reference $1/$3 only, not $2 */
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Referencing `$2` where the second RHS symbol lacks a `%type`/`%token <Tag>` declaration in a grammar that otherwise uses typed values.

Common situations: Adding a symbol to a production and using it via `$N` before declaring its type; referencing a literal token (which has no value) positionally.

Related errors


AI-assisted analysis of mono/mono@0f53e9e151 (2026-08-13). Data as JSON: /api/errors/b40e7979043a1f91. Report an issue: GitHub.