Skip to content
This repository was archived by the owner on Jun 5, 2023. It is now read-only.
This repository was archived by the owner on Jun 5, 2023. It is now read-only.

Allow Infix on enum #152

@bishabosha

Description

@bishabosha

Minimized code

example 1:

infix enum mul[T <: Int, U <: Int] {                                                                                                                       
  case Refl(r: compiletime.ops.int.*[T,U])
}

example 2:

enum Expr {
  infix case Add(l: Expr, r: Expr)
  case Lit(i: Int)
}

Output

example 1:

1 |infix enum mul[T <: Int, U <: Int] { 
  |           ^^^
  |           Only access modifiers are allowed on enum definitions

example 2:

2 |    infix case Add(l: Expr, r: Expr)
  |          ^^^^
  |          end of statement expected but 'case' found
2 |    infix case Add(l: Expr, r: Expr)
  |               ^^^
  |               ';' expected, but identifier found

Expectation

infix is allowed for a class definition:

example 1:

infix sealed trait mul[T <: Int, U <: Int]
object mul {
  final case class Refl[T <: Int, U <: Int](r: compiletime.ops.int.*[T,U]) extends (T mul U)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions