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

Only pickle StableRealizable flag for methods #11858

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions compiler/src/dotty/tools/dotc/core/Flags.scala
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ object Flags {
*
* - the purity analysis used by the inliner to decide whether it is safe to elide, and
* - the TASTy reader of Scala 2.13, to determine whether there is a $init$ method.
*
* StableRealizable is
* - asserted for methods
* - automatic in conjunction with Module or Enum vals
* - cached for other vals
*/
val (_, StableRealizable @ _, _) = newFlags(24, "<stable>")

Expand Down Expand Up @@ -584,6 +589,7 @@ object Flags {
val MethodOrModule: FlagSet = Method | Module
val ParamForwarder: FlagSet = Method | ParamAccessor | StableRealizable // A parameter forwarder
val PrivateMethod: FlagSet = Method | Private
val StableMethod: FlagSet = Method | StableRealizable
val NoInitsInterface: FlagSet = NoInits | PureInterface
val NoInitsTrait: FlagSet = NoInits | Trait // A trait that does not need to be initialized
val ValidForeverFlags: FlagSet = Package | Permanent | Scala2SpecialFlags
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ class TreePickler(pickler: TastyPickler) {
if (flags.is(Accessor)) writeModTag(FIELDaccessor)
if (flags.is(CaseAccessor)) writeModTag(CASEaccessor)
if (flags.is(HasDefault)) writeModTag(HASDEFAULT)
if (flags.is(StableRealizable)) writeModTag(STABLE)
if flags.isAllOf(StableMethod) then writeModTag(STABLE) // other StableRealizable flag occurrences are either implied or can be recomputed
if (flags.is(Extension)) writeModTag(EXTENSION)
if (flags.is(ParamAccessor)) writeModTag(PARAMsetter)
if (flags.is(SuperParamAlias)) writeModTag(PARAMalias)
Expand Down
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,9 @@ class TreeUnpickler(reader: TastyReader,
if (lacksDefinition && tag != PARAM) flags |= Deferred
if (tag == DEFDEF) flags |= Method
if (givenFlags.is(Module))
flags = flags | (if (tag == VALDEF) ModuleValCreationFlags else ModuleClassCreationFlags)
flags |= (if (tag == VALDEF) ModuleValCreationFlags else ModuleClassCreationFlags)
if flags.is(Enum, butNot = Method) && name.isTermName then
flags |= StableRealizable
if (ctx.owner.isClass) {
if (tag == TYPEPARAM) flags |= Param
else if (tag == PARAM) {
Expand Down