Skip to content

Xprint doesn't show literal types correctly #22349

Closed
@hamzaremmal

Description

@hamzaremmal

Compiler version

5176f9f

Minimized code

Printing the tree with -Xprint:parser returns code that is not valid scala 3 code

inline val _: true = true   // boolean literal
inline val _: "abc" = "abc" // string literal
inline val _: 'c' = 'c'     // character literal
inline val _: 1.2f = 1.2f   // floating point literal
inline val _: 1.2d = 1.2d   // double number literal

Output

[[syntax trees at end of                    parser]] // playground.scala
package <empty> {
  inline val _: true.type = true
  inline val _: "abc".type = "abc"
  inline val _: 'c'.type = 'c'
  inline val _: 1.2f.type = 1.2f
  inline val _: 1.2d.type = 1.2d
}

Expectation

[[syntax trees at end of                    parser]] // playground.scala
package <empty> {
  inline val _: true = true
  inline val _: "abc" = "abc"
  inline val _: 'c' = 'c'
  inline val _: 1.2f = 1.2f
  inline val _: 1.2d = 1.2d
}

Metadata

Metadata

Assignees

Labels

itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions