Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint identifies type error in generated code for tests #464

Open
BurtHarris opened this issue Apr 19, 2020 · 2 comments · May be fixed by #454
Open

ESLint identifies type error in generated code for tests #464

BurtHarris opened this issue Apr 19, 2020 · 2 comments · May be fixed by #454

Comments

@BurtHarris
Copy link
Collaborator

BurtHarris commented Apr 19, 2020

I'm working on integrating ESLint into antlr4ts. One error keeps coming up that seems to be a real bug, apparently in generated test code. The message is: Argument of type 'Token' is not assignable to parameter of type 'number'.

It repeatedly appears on the process.stdout.write line below, objecting to _localctx._a._start being used as if it is a number.

public s(): SContext {
	let _localctx: SContext = new SContext(this._ctx, this.state);
	this.enterRule(_localctx, 0, MParser.RULE_s);
	try {
		this.enterOuterAlt(_localctx, 1);
			{
			this.state = 4;
			_localctx._a = this.a();
			process.stdout.write(String((_localctx._a != null ? this._input.getTextFromRange(_localctx._a._start, _localctx._a._stop) : undefined)));
			}
		}
		catch (re) {
			...
@BurtHarris
Copy link
Collaborator Author

Problem was a misdeclaration of getTextFromRange.

@BurtHarris
Copy link
Collaborator Author

tracking

@BurtHarris BurtHarris reopened this Apr 19, 2020
@BurtHarris BurtHarris self-assigned this Apr 19, 2020
@BurtHarris BurtHarris linked a pull request Apr 26, 2020 that will close this issue
@BurtHarris BurtHarris linked a pull request Apr 26, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant