Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

som-snytt
Copy link
Contributor

-Yuntil:refchecks to limp onward and witness
helpful errors in refchecks.

Fixes scala/bug#5159

`-Yuntil:refchecks` to limp onward and witness
helpful errors in refchecks.
@scala-jenkins scala-jenkins added this to the 2.13.4 milestone Jul 31, 2020
Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. I'm not sure I'll always remember to use it, but it's 5 extra lines around it (at least right now... famous last words!) to add a possibly very useful tool to the tool bag.

Particularly if this were accepted I may now start to collapse my partests without being paranoid that warnings (made fatal) in earlier phases are hiding away warnings emitted in later phases from being present in the checkfiles... (e.g. the nullary method/Xsource:3 warnings)

@sjrd
Copy link
Member

sjrd commented Aug 12, 2020

This opens many new ways that the compiler could crash. Until now, all phases could assume that the previous phases ran without error, and that, therefore, the program respected all invariants checked by previous phases. For example, all phases after typer assume that there is no erroneous type in trees.

If you allow phases to run after another one had errors, you break this. This could lead to many new compiler crashes.

@dwijnand
Copy link
Member

Are you against it or are you saying this needs some amends to set expectations appropriately?

@sjrd
Copy link
Member

sjrd commented Aug 12, 2020

I'm against it. This breaks invariants that the compiler relies on not to crash. Unless there is an audit of all phases to identify and fix all places where they rely on those invariants, this change basically creates new crashes by design. And that's even without counting compiler plugins.

Try and enable this flag with "until cleanup" on all neg tests: I'm sure you'll notice how bad this is.

@dwijnand
Copy link
Member

dwijnand commented Aug 12, 2020

I'm sure you'll notice how bad this is.

How bad is it? A -Y flag that may cause new compiler crashes doesn't concern me, provided it doesn't do something destructive like delete the source files.

@som-snytt
Copy link
Contributor Author

I considered restricting to -Yrun-to-refchecks, which may be the only use case.

Conceivably, someone may like to ignore some unrelated error to exercise a plugin which runs later.

I don't have a strong argument for that use case; a plugin author might chime in to say they needed that once.

The argument in favor is that -Y has a low bar. There have always been -Y options that are crashy or unstable.

The counter-argument is that -Wconf is supposed to let you ignore an error. Is it convenient enough for the use case, "What would refchecks say?" -Wwrs.

@som-snytt som-snytt marked this pull request as draft August 25, 2020 16:41
@som-snytt
Copy link
Contributor Author

Drafting for improved ergonomics and sjrd-friendliness. For a single run, enabling refchecks is viable even with potential for crash, but not in resident or incremental case. As noted above, when would you even think to enable a flag? If compiler doesn't do refchecks safely always to add more info to error case, then there isn't much point.

@lrytz
Copy link
Member

lrytz commented Sep 24, 2020

I'm also against this feature in its generality.

What I could imagine is a way to run only refchecks (possibly with some of its checks / transformations disabled) after an erroneous typer phase. Running other phases doesn't make sense, they don't report any errors (except maybe some of the form "this is OK Scala code but sadly can't be represented in classfiles, sorry").

@sjrd what do you think about that?

@som-snytt
Copy link
Contributor Author

I just noticed a semantically relevant dotty error obscured by a subsequent error. (As happens.) I want to see the "previous" error. Here, I want to run short-circuited checks and see those "subsequent" errors. It's like a Stephen Hawking thing where peering into the past is symmetrical to peering into the future.

@sjrd
Copy link
Member

sjrd commented Sep 24, 2020

@lrytz That is clearly less bad than the general feature. Did you mean to run only refchecks (and not other phases between typer and refchecks) or everything until refchecks?

  • Only refchecks could report spurious errors for codebases with (arguably bad?) compiler plugins inserting a phase between typer and refchecks that "fixes" things that would otherwise be reported by refchecks. It's not entirely unheard of: I think that Mill has such a phase to slap override automatically for you.
  • Everything until refchecks could have other consequences, this time with a larger set of compiler plugins: every phase added by a compiler plugin between typer and refchecks might crash on unexpected inputs.

Now, if we audit refchecks well enough, and test it well enough on inputs that don't pass typer, then at least we could limit the new-kinds-of-crashes area to such compiler plugins.

Testing it well enough, IMO, is at the very least testing that refchecks does not crash on any of the existing neg tests.

@som-snytt som-snytt closed this Sep 24, 2020
@lrytz
Copy link
Member

lrytz commented Sep 24, 2020

Did you mean to run only refchecks

Yes - but i see your point about plugins.

@dwijnand dwijnand removed this from the 2.13.4 milestone Oct 16, 2020
@som-snytt som-snytt deleted the issue/5159 branch December 19, 2020 01:15
@som-snytt
Copy link
Contributor Author

Summary, a tool that runs only "checks" after failing typer and probably only to refchecks checks.

@som-snytt som-snytt changed the title Allow progress after erroring [REJECTED/REVISIT] Allow progress after erroring Jan 27, 2024
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

Successfully merging this pull request may close these issues.

Wrong (misleading) error in code that is (non-obviously) incorrect
5 participants