PR modula2/118453: Subranges types do not use virtual tokens during construction
P2SymBuild.mod.BuildSubrange does not use a virtual token and therefore
any error message containing a subrange type produces poor location carots.
This patch rewrites BuildSubrange and the buildError4 procedure in
M2Check.mod (which is only called when there is a formal/actual parameter
mismatch). buildError4 now issues a sub error for the formal and actual
type declaration highlighing the type mismatch.
gcc/m2/ChangeLog:
PR modula2/118453
* gm2-compiler/M2Check.mod (buildError4): Call MetaError1
for the actual and formal parameter type.
* gm2-compiler/P2Build.bnf (SubrangeType): Construct a virtual
token containing the subrange type declaration.
(PrefixedSubrangeType): Ditto.
* gm2-compiler/P2SymBuild.def (BuildSubrange): Add tok parameter.
* gm2-compiler/P2SymBuild.mod (BuildSubrange): Use tok parameter,
rather than the token at the start of the subrange.
gcc/testsuite/ChangeLog:
PR modula2/118453
* gm2/pim/fail/badbecomes2.mod: New test.
* gm2/pim/fail/badparamset1.mod: New test.
* gm2/pim/fail/badparamset2.mod: New test.
* gm2/pim/fail/badsyntaxset1.mod: New test.
Signed-off-by:
Gaius Mulley <gaiusmod2@gmail.com>
Showing
- gcc/m2/gm2-compiler/M2Check.mod 3 additions, 5 deletionsgcc/m2/gm2-compiler/M2Check.mod
- gcc/m2/gm2-compiler/P2Build.bnf 12 additions, 5 deletionsgcc/m2/gm2-compiler/P2Build.bnf
- gcc/m2/gm2-compiler/P2SymBuild.def 1 addition, 1 deletiongcc/m2/gm2-compiler/P2SymBuild.def
- gcc/m2/gm2-compiler/P2SymBuild.mod 3 additions, 4 deletionsgcc/m2/gm2-compiler/P2SymBuild.mod
- gcc/testsuite/gm2/pim/fail/badbecomes2.mod 9 additions, 0 deletionsgcc/testsuite/gm2/pim/fail/badbecomes2.mod
- gcc/testsuite/gm2/pim/fail/badparamset1.mod 16 additions, 0 deletionsgcc/testsuite/gm2/pim/fail/badparamset1.mod
- gcc/testsuite/gm2/pim/fail/badparamset2.mod 16 additions, 0 deletionsgcc/testsuite/gm2/pim/fail/badparamset2.mod
- gcc/testsuite/gm2/pim/fail/badsyntaxset1.mod 8 additions, 0 deletionsgcc/testsuite/gm2/pim/fail/badsyntaxset1.mod
Loading
Please register or sign in to comment