Commit e06df02
[K/N] Fixed a corner case in casts optimization pass
The alogrithm handles differently two types of variables - T? and Boolean.
The first type is used in expressions like if (var == null) { .. } or if (var != null) { .. },
while the other is used in just if (variable) { .. } or if (!variable) { .. }. But in one case,
a variable might change its type - when a Boolean? variable gets aliased to a Boolean variable.
This wasn't expected and there was an assertion for such a case (a variable can't change its kind).
This commit fixes this by supporting this peculiar corner case.
#KT-81257 Fixed1 parent 8ee4fb9 commit e06df02
File tree
1 file changed
+7
-1
lines changed- kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/optimizations
1 file changed
+7
-1
lines changedLines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
645 | | - | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
646 | 652 | | |
647 | 653 | | |
648 | 654 | | |
| |||
0 commit comments