Skip to content

Commit

Permalink
Merge pull request #9825 from lrytz/t12500
Browse files Browse the repository at this point in the history
Don't emit `releaseFence` for class params of specialized classes
  • Loading branch information
lrytz committed Dec 10, 2021
2 parents b2da0ea + 8f0577c commit 6ca41af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -750,7 +750,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {

for (m <- normMembers) {
if (!needsSpecialization(fullEnv, m)) {
if (m.isValue && !m.isMutable && !m.isMethod && !m.isDeferred && !m.isLazy) {
if (m.isValue && !m.isMutable && !m.isMethod && !m.isDeferred && !m.isLazy && !m.isParamAccessor) {
// non-specialized `val` fields are made mutable (in Constructors) and assigned from the
// constructors of specialized subclasses. See PR scala/scala#9704.
clazz.primaryConstructor.updateAttachment(ConstructorNeedsFence)
Expand Down
2 changes: 1 addition & 1 deletion test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala
Expand Up @@ -393,7 +393,7 @@ class BytecodeTest extends BytecodeTesting {
@Test
def nonSpecializedValFence(): Unit = {
def code(u1: String) =
s"""abstract class Speck[@specialized(Int) T](t: T) {
s"""abstract class Speck[@specialized(Int) T](t: T, sm: String, val sn: String) {
| val a = t
| $u1
| lazy val u2 = "?"
Expand Down

0 comments on commit 6ca41af

Please sign in to comment.