[5.9] Switch expression won't compile when assigning value to already defined variable. #66412
Labels
assignments
Feature → expressions: assignments
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
expressions
Feature: expressions
swift 5.9
switch
Feature → statements: 'switch' statements
type checker
Area → compiler: Semantic analysis
unexpected error
Bug: Unexpected error
Description
Function
foo1
will not compile but functionfoo2
will. Compilator error isCannot find 'val' in scope
. The difference is only with declaration and initialization ofbar
variable.Steps to reproduce
Try to compile above code in Xcode 15.0 beta.
Expected behavior
Both functions compile.
Environment
The text was updated successfully, but these errors were encountered: