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

Skip to content

Compiler determinism for synthetic companions #8864

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

Merged
merged 2 commits into from
Jun 30, 2020

Conversation

retronym
Copy link
Member

@retronym retronym commented Apr 8, 2020

@scala-jenkins scala-jenkins added this to the 2.13.3 milestone Apr 8, 2020
@retronym retronym changed the title Compiler determnisn for synthetic companions and root import exclusion Compiler determism for synthetic companions and root import exclusion Apr 8, 2020
@retronym retronym requested a review from som-snytt April 8, 2020 07:20
@retronym retronym modified the milestones: 2.13.3, 2.13.2 Apr 8, 2020
@retronym
Copy link
Member Author

retronym commented Apr 8, 2020

Marking for consideration for 2.13.2. /cc @lrytz

@retronym retronym changed the title Compiler determism for synthetic companions and root import exclusion Compiler determinism for synthetic companions and root import exclusion Apr 8, 2020
@som-snytt
Copy link
Contributor

That's pretty clever, to simplify the import exclusion. So now you get one shot at exclusion; it can be triggered by an arbitrary lookup, but the idiom must be a preceding package level import? If the source has two packagings, does order matter? I'd have to try it. Actually, an import in a sibling packaging would not be an enclosing context. Maybe you choose not to support that; it might trigger the error; in addition, I now think this is a terrible feature anyway and should receive minimal support.

Also, I verified that the determinism test fails, but the scala signature diff is not meaningful to me. The test for ordering of the implicit class defs is more obvious.

The repl knows if it has to insert the import somewhere, but maybe the template breaks the test t11897. t1931 is also repl, a SessionTest!

neg/predef-masking.scala should just work. Oh, is it because the import already triggers lookup? So the second import no longer excludes -Yimports:hello.world.minidef.

import hello.{world => hw}
import hw.minidef.{Magic => Answer}

@lrytz lrytz modified the milestones: 2.13.2, 2.13.3 Apr 9, 2020
@som-snytt
Copy link
Contributor

I'll take a look; my speculation was wrong, so I'll have to refresh how namers works...

@SethTisue SethTisue modified the milestones: 2.13.3, 2.13.4 May 12, 2020
@retronym retronym force-pushed the topic/determinism branch 3 times, most recently from 6bb1c13 to 0c4ef4a Compare June 10, 2020 04:01
@retronym retronym changed the title Compiler determinism for synthetic companions and root import exclusion Compiler determinism for synthetic companions Jun 30, 2020
@retronym retronym force-pushed the topic/determinism branch from 0c4ef4a to 9b26381 Compare June 30, 2020 00:23
@retronym
Copy link
Member Author

retronym commented Jun 30, 2020

A solution for the non-determinism for root import exclusion (scala/bug#11867) eludes me, so I've reduced this PR to solving the issue of stabilizing the order synthetic modules in Scopes (scala/bug#12066).

@retronym retronym requested a review from lrytz June 30, 2020 00:26
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.

Compilation of code with synthetic companion objects is non-deterministic
5 participants