Skip to content

Pickling test fails for annotated types #15956

Open
@Linyxus

Description

@Linyxus

(taken from tests/pos/i15922.scala in #15948)

Compiler version

main

Minimized code

trait Cap:
  type M

class Id[X]

object Test:
  def withCap[X](op: Cap => X): X = ???

  class retains1(xs: Any*) extends annotation.StaticAnnotation

  def leaking1(c: Cap): Id[Cap @retains1(c)] = ??? // used to crash with orphan parameter on pickling
  def leaking2(c: Cap): Id[c.type] = ???

  val bad1 = withCap(leaking1)
  val bad2 = withCap(leaking2)

Output

Pickling test fails with -Xprint-types -Ytest-pickler -Yprint-pos -Yprint-pos-syms.

Expectation

It should pass the pickling test (i.e. the representation before and after pickling should be the same).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions