Skip to content
Snippets Groups Projects
Commit 7cd4de65 authored by Gaius Mulley's avatar Gaius Mulley
Browse files

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: default avatarGaius Mulley <gaiusmod2@gmail.com>
parent d23d338d
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment