-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make LazyVals implement non-static modules. Move LV after erasure. #493
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
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
b1ce9c2
Mixin: needs to call transformFollowing to make memoize run on traitI…
DarkDimius e1c482a
Make Memoize not depend on prepareForDefDef.
DarkDimius b50d209
Make Constructors change owners.
DarkDimius de67c05
Allow FutureDefs in changeOwner
odersky ebb3917
Reset some flags for bridges.
odersky 979ee0f
Fix changeOwnerAfter by adding transformDenotations method.
odersky bcc6bf7
Remove dead code in Constructors
odersky a2813d2
Mixin: do not remove Module Flag.
DarkDimius 5937b88
Make LazyVals implement non-static modules. Move LV after erasure.
DarkDimius fe8c717
Add a test for a deferred object in interface.
DarkDimius 9c150c5
Getters now also makes getters for lazy vals.
DarkDimius a274d8d
Generate getters for modules in LV.
DarkDimius cf4ee1d
LV runs after memoize. Use setters.
DarkDimius a049c82
Fix two infinite cycles in transformAfter.
DarkDimius f9a15df
Mixing should make initialisers out of lazy vals.
DarkDimius d0f9d6d
Compiler: add comment on problems in late phases.
DarkDimius 75588e9
tpd.WhileDo helper.
DarkDimius 74054a4
LazyVals needs to run after Mixin.
DarkDimius c201309
LazyVals: filter out flag combinations that do not make sense.
DarkDimius 7517d99
LazyVals: create less names.
DarkDimius f8f908f
LazyVals: Emitting switch instruction requires default case.
DarkDimius 4615f76
Make LazyVals.getOffset work on j.l.Class instead of taking the insta…
DarkDimius d75d872
Remove code duplication in LazyVals.
DarkDimius f322c98
LazyValues: minor post-erasure changes.
DarkDimius ca11f55
Make Lazy-vals generated fields private.
DarkDimius fc20556
Fix tpd.ref(sum) to work after erasure.
DarkDimius f892614
Update comment on ExplicitOuter.
DarkDimius dd65b3e
We do not plan to have more than Int.MaxValue of lazy vals.
DarkDimius 086b1c2
LazyVals: expected value of flag takes only tree values, no need to u…
DarkDimius 7ef1bd5
Disable failing tests. See #503
DarkDimius e24a24d
LazyVals - do not rely on absence of name clashes in scope.
DarkDimius 4a379ec
LazyVals: Synchronized is `Object => Object` after erasure, #505
DarkDimius 52c56a2
LazyVals: eagerly enter private symbols.
DarkDimius 19c8220
fix a bug in transformAfter: iterate over a new denotation instead of…
DarkDimius 56195fc
Fix bug in transformAfter: transform the last denotation in cycle.
DarkDimius 4e277dc
Fix spurious warnings in TreeChecker.
DarkDimius 9bf697c
LazyVals: last fix that allows to compile -deep dotc.
DarkDimius b5f76e5
Enable emmiting byte code for all tests. Compile Dotty.
DarkDimius 3b4c230
Increase heap and stack size on travis.
DarkDimius c4b61af
DottyBackendInterface: interface members cannot be final
DarkDimius 10d05f3
Decrease default sizes of buffers.
DarkDimius ceb2edd
Fix two ArrayIndexOutOfBoundsExceptions in TastyBuffer.
DarkDimius dc21d95
Leave traces for future profiling.
DarkDimius 98f8ab8
LV: Rename methods.
DarkDimius 61f0517
Comment why LazyVals needs to reorder stats in blocks.
DarkDimius 3964a18
LV: change naming convention.
DarkDimius d23e71a
Replace .entered by .enteredAfter in LazyVals.
DarkDimius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,21 @@ import Decorators._ | |
/** Performs the following rewritings for fields of a class: | ||
* | ||
* <mods> val x: T = e | ||
* --> <mods> <stable> def x: T = e | ||
* --> <mods> <stable> <accessor> def x: T = e | ||
* <mods> var x: T = e | ||
* --> <mods> def x: T = e | ||
* --> <mods> <accessor> def x: T = e | ||
* | ||
* <mods> val x: T | ||
* --> <mods> <stable> def x: T | ||
* --> <mods> <stable> <accessor> def x: T | ||
* | ||
* <mods> lazy val x: T = e | ||
* --> <mods> <accessor> lazy def x: T =e | ||
* | ||
* <mods> var x: T | ||
* --> <mods> def x: T | ||
* --> <mods> <accessor> def x: T | ||
* | ||
* <mods> non-static <module> val x$ = e | ||
* --> <mods> <module> <accessor> def x$ = e | ||
* | ||
* Omitted from the rewritings are | ||
* | ||
|
@@ -47,18 +53,18 @@ class Getters extends MiniPhaseTransform with SymTransformer { thisTransform => | |
override def transformSym(d: SymDenotation)(implicit ctx: Context): SymDenotation = { | ||
def noGetterNeeded = | ||
d.is(NoGetterNeeded) || | ||
d.initial.asInstanceOf[SymDenotation].is(PrivateLocal) && !d.owner.is(Trait) || | ||
d.initial.asInstanceOf[SymDenotation].is(PrivateLocal) && !d.owner.is(Trait) && !d.is(Flags.Lazy) || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flags. is redundant here. |
||
d.is(Module) && d.isStatic || | ||
d.isSelfSym | ||
if (d.isTerm && d.owner.isClass && d.info.isValueType && !noGetterNeeded) { | ||
if (d.isTerm && (d.is(Lazy) || d.owner.isClass) && d.info.isValueType && !noGetterNeeded) { | ||
val maybeStable = if (d.isStable) Stable else EmptyFlags | ||
d.copySymDenotation( | ||
initFlags = d.flags | maybeStable | AccessorCreationFlags, | ||
info = ExprType(d.info)) | ||
} | ||
else d | ||
} | ||
private val NoGetterNeeded = Method | Param | JavaDefined | JavaStatic | Lazy | ||
private val NoGetterNeeded = Method | Param | JavaDefined | JavaStatic | ||
|
||
override def transformValDef(tree: ValDef)(implicit ctx: Context, info: TransformerInfo): Tree = | ||
if (tree.symbol is Method) DefDef(tree.symbol.asTerm, tree.rhs) else tree | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ref(sym).appliedToNone? (Not a strong opinion on this).