+
+#######################################################################
+
+AT_SETUP([Unresolved references])
+AT_DATA_GRAMMAR([test.y],
+[[
+%%
+stat:
+ sym_a sym_b { func($sym.field); }
+| sym_a sym_b { func($<aa>sym.field); }
+| sym_a sym_b { func($[sym.field]); }
+| sym_a sym_b { func($<aa>[sym.field]); }
+| sym_a sym_b { func($sym); }
+| sym_a sym_b { func($<aa>sym); }
+| sym_a sym_b { func($[sym]); } sym_a sym_b { func($<aa>[sym]); }
+;
+
+stat1:
+ sym_a sym_b { func($sym-field); }
+| sym_a sym_b { func($<aa>sym-field); }
+| sym_a sym_b { func($[sym-field]); }
+| sym_a sym_b { func($<aa>[sym-field]); }
+| sym_a sym_b { func($sym); }
+| sym_a sym_b { func($<aa>sym); }
+| sym_a sym_b { func($[sym]); } sym_a sym_b { func($<aa>[sym]); }
+;
+
+sym_a: 'a';
+sym_b: 'b';
+]])
+AT_BISON_CHECK([-o test.c test.y], 1, [],
+[[test.y:12.22-31: invalid reference: `$sym.field'
+test.y:12.3-35: symbol not found in production: sym
+test.y:13.22-35: invalid reference: `$<aa>sym.field'
+test.y:13.3-39: symbol not found in production: sym
+test.y:14.22-33: invalid reference: `$[sym.field]'
+test.y:14.3-37: symbol not found in production: sym.field
+test.y:15.22-37: invalid reference: `$<aa>[sym.field]'
+test.y:15.3-41: symbol not found in production: sym.field
+test.y:16.22-25: invalid reference: `$sym'
+test.y:16.3-29: symbol not found in production: sym
+test.y:17.22-29: invalid reference: `$<aa>sym'
+test.y:17.3-33: symbol not found in production: sym
+test.y:18.22-27: invalid reference: `$[sym]'
+test.y:18.3-65: symbol not found in production before $3: sym
+test.y:18.52-61: invalid reference: `$<aa>[sym]'
+test.y:18.3-65: symbol not found in production: sym
+test.y:22.22-31: invalid reference: `$sym-field'
+test.y:22.3-35: symbol not found in production: sym
+test.y:23.22-35: invalid reference: `$<aa>sym-field'
+test.y:23.3-39: symbol not found in production: sym
+test.y:24.22-33: invalid reference: `$[sym-field]'
+test.y:24.3-37: symbol not found in production: sym-field
+test.y:25.22-37: invalid reference: `$<aa>[sym-field]'
+test.y:25.3-41: symbol not found in production: sym-field
+test.y:26.22-25: invalid reference: `$sym'
+test.y:26.3-29: symbol not found in production: sym
+test.y:27.22-29: invalid reference: `$<aa>sym'
+test.y:27.3-33: symbol not found in production: sym
+test.y:28.22-27: invalid reference: `$[sym]'
+test.y:28.3-65: symbol not found in production before $3: sym
+test.y:28.52-61: invalid reference: `$<aa>[sym]'
+test.y:28.3-65: symbol not found in production: sym
+]])
+AT_CLEANUP
+
+#######################################################################
+
+AT_SETUP([[$ or @ followed by . or -]])
+AT_DATA([[test.y]],
+[[
+%%
+start:
+ .field { $.field; }
+| 'a' { @.field; }
+;
+.field: ;
+]])
+AT_BISON_CHECK([[test.y]], [[1]], [],
+[[test.y:4.12-18: invalid reference: `$.field'
+test.y:4.13: syntax error after `$', expecting integer, letter, `_', `@<:@', or `$'
+test.y:4.3-8: possibly meant: $[.field] at $1
+test.y:5.12-18: invalid reference: `@.field'
+test.y:5.13: syntax error after `@', expecting integer, letter, `_', `@<:@', or `$'
+]])
+AT_DATA([[test.y]],
+[[
+%%
+start:
+ 'a' { $-field; }
+| 'b' { @-field; }
+;
+]])
+AT_BISON_CHECK([[test.y]], [[0]], [],
+[[test.y:4.9: warning: stray `$'
+test.y:5.9: warning: stray `@'
+]])
+AT_CLEANUP