Fix bug: Switch statements crash when switching to the fallback branch
This commit is contained in:
parent
f04553ac4d
commit
237c83f511
2
ir.py
2
ir.py
|
@ -278,7 +278,7 @@ class Switch:
|
||||||
if n in self.branches:
|
if n in self.branches:
|
||||||
return Some(self.branches[n])
|
return Some(self.branches[n])
|
||||||
else:
|
else:
|
||||||
return None
|
return Some(self.fallback)
|
||||||
raise Exception('Attempted to switch on non-integer value')
|
raise Exception('Attempted to switch on non-integer value')
|
||||||
raise Exception('Unreachable')
|
raise Exception('Unreachable')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue