Skip to content

Pattern matcher does not generate ValDefs for defined pattern bound variables #190

@odersky

Description

@odersky

When compiling pos/functions1.scala I observe the following code snippet

  val x33: String => String = {
    def $anonfun(x22: String): String = {
      case val selector11: String = x22
      {
        def case11(): String = {
          def case21(): String = {
            def matchFail11(): String = throw new MatchError(selector11)
            {
              x34
            }
          }
          if "abc".equals(selector11) then {
            val x21: String = selector11
            {
              ""
            }
          } else case21()
        }
        case11()
      }
    }
    closure($anonfun)
  }

You need to compile against the latest commit with the changed functions1.scala or else compile with -uniqid to observe the effect: In both cases, the definition of the pattern bound variable x34 is missing.

Detected when trying to lambda-lift this code.

Metadata

Metadata

Assignees

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