Skip to content

Val is not stable unless path requested by use site #9276

Closed
@bishabosha

Description

@bishabosha

it seems that a val is not stable in TASTy unless a stable path is requested for it:

Minimized code

// before
object Consts {
  val msg = "Hello World" // not stable
}
object TestConsts {
  def foo = Consts.msg
}
// after
object Consts {
  val msg = "Hello World" // now it is stable because of a use site
}
object TestConsts {
  def foo: Consts.msg.type = Consts.msg
}

Output

before:

80:       VALDEF(7) 26 [msg]
83:         TYPEREF 27 [String]
85:           SHAREDtype 35
87:         STRINGconst 28 [Hello World]

after:

80:       VALDEF(8) 26 [msg]
83:         TYPEREF 27 [String]
85:           SHAREDtype 35
87:         STRINGconst 28 [Hello World]
89:         STABLE

Expectation

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions