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

Suppress or fix warnings in generated Kotlin code #82

Open
hakanai opened this issue Oct 18, 2022 · 0 comments
Open

Suppress or fix warnings in generated Kotlin code #82

hakanai opened this issue Oct 18, 2022 · 0 comments

Comments

@hakanai
Copy link

hakanai commented Oct 18, 2022

There are a bunch of warnings in the code generated by the tool.

Notably:

The unused value here - an interesting case because if the setter isn't supported, maybe it should have generated a val instead of a var and merely not had a setter?

	    override var ruleIndex: Int
	        get() = Rules.RULE_start.id
	        set(value) { throw RuntimeException() }

The many cases of redundant casts - for these, the cast is always redundant because the is check will cause a smart cast:

		override fun enterRule(listener: ParseTreeListener) {
			if ( listener is RealExpressionListener ) (listener as RealExpressionListener).enterStart(this)
		}

And this one in the lexer where it's casting from Array<DFA> to Array<DFA?>:

		this.interpreter = LexerATNSimulator(this, ATN, decisionToDFA as Array<DFA?>, sharedContextCache)

If the warnings can be fixed, that'd be perfect, but it's generated code, so perhaps the generator could add @Suppress annotations to the classes to suppress any warnings they generate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant