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

Recover from TypeErrors in isErroneous #15442

Merged
merged 1 commit into from
Jun 15, 2022
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 14, 2022

Fixes #15293 (hopefully)

@odersky
Copy link
Contributor Author

odersky commented Jun 15, 2022

How I fixed it:

That one was simple. Looking at the stacktrace:

at dotty.tools.dotc.core.Types$NamedType.argDenot(Types.scala:2326)
        at dotty.tools.dotc.core.Types$NamedType.fromDesignator$1(Types.scala:2240)
        at dotty.tools.dotc.core.Types$NamedType.computeDenot(Types.scala:2258)
        at dotty.tools.dotc.core.Types$NamedType.denot(Types.scala:2213)
        at dotty.tools.dotc.core.Types$NamedType.info(Types.scala:2201)
        at dotty.tools.dotc.core.TypeApplications$.typeParams$extension(TypeApplications.scala:185)
        at dotty.tools.dotc.core.Types$AppliedType.tyconTypeParams(Types.scala:4456)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6004)
        at dotty.tools.dotc.core.Types$ExistsAccumulator.apply(Types.scala:6095)
        at dotty.tools.dotc.core.Types$Type.existsPart(Types.scala:452)
        at dotty.tools.dotc.core.Types$Type.isErroneous(Types.scala:359)
        at scala.meta.internal.pc.printer.MetalsPrinter.tpe(MetalsPrinter.scala:67)

Something went wrong in isErroneous which was called from MetalsPrinter. isErroneous should always default to true instead of throwing an exception. So I put in a handler for the thrown TypeError exception.

Why not put in a more sweeping handler for all exceptions? Since that one could hide bugs that I might want to see. I'd like to verify that an exception is plausible and does not hide a larger problem before it gets caught and ignored in isErroneous.

@odersky
Copy link
Contributor Author

odersky commented Jun 15, 2022

Going to merge it now, so that it makes it into 3.2

@odersky odersky merged commit bf026ad into scala:main Jun 15, 2022
@odersky odersky deleted the fix-15293 branch June 15, 2022 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bad parameter reference F at typer
3 participants