@@ -5541,11 +5541,11 @@ export class Compiler extends DiagnosticEmitter {
5541
5541
let rightFlow = flow . fork ( ) ;
5542
5542
this . currentFlow = rightFlow ;
5543
5543
rightFlow . inheritNonnullIfTrue ( leftExpr ) ;
5544
- rightExpr = this . compileExpression ( right , leftType , inheritedConstraints | Constraints . CONV_IMPLICIT ) ;
5545
- rightType = leftType ;
5546
5544
5547
5545
// simplify if only interested in true or false
5548
5546
if ( contextualType == Type . bool || contextualType == Type . void ) {
5547
+ rightExpr = this . compileExpression ( right , leftType , inheritedConstraints ) ;
5548
+ rightType = this . currentType ;
5549
5549
rightExpr = this . performAutoreleasesWithValue ( rightFlow , rightExpr , rightType ) ;
5550
5550
rightFlow . freeScopedLocals ( ) ;
5551
5551
this . currentFlow = flow ;
@@ -5557,6 +5557,8 @@ export class Compiler extends DiagnosticEmitter {
5557
5557
this . currentType = Type . bool ;
5558
5558
5559
5559
} else {
5560
+ rightExpr = this . compileExpression ( right , leftType , inheritedConstraints | Constraints . CONV_IMPLICIT ) ;
5561
+ rightType = this . currentType ;
5560
5562
5561
5563
// references must properly retain and release, with the same outcome independent of the branch taken
5562
5564
if ( leftType . isManaged ) {
@@ -5643,11 +5645,11 @@ export class Compiler extends DiagnosticEmitter {
5643
5645
let rightFlow = flow . fork ( ) ;
5644
5646
this . currentFlow = rightFlow ;
5645
5647
rightFlow . inheritNonnullIfFalse ( leftExpr ) ;
5646
- rightExpr = this . compileExpression ( right , leftType , inheritedConstraints | Constraints . CONV_IMPLICIT ) ;
5647
- rightType = leftType ;
5648
5648
5649
5649
// simplify if only interested in true or false
5650
5650
if ( contextualType == Type . bool || contextualType == Type . void ) {
5651
+ rightExpr = this . compileExpression ( right , leftType , inheritedConstraints ) ;
5652
+ rightType = this . currentType ;
5651
5653
rightExpr = this . performAutoreleasesWithValue ( rightFlow , rightExpr , leftType ) ;
5652
5654
rightFlow . freeScopedLocals ( ) ;
5653
5655
this . currentFlow = flow ;
@@ -5659,6 +5661,8 @@ export class Compiler extends DiagnosticEmitter {
5659
5661
this . currentType = Type . bool ;
5660
5662
5661
5663
} else {
5664
+ rightExpr = this . compileExpression ( right , leftType , inheritedConstraints | Constraints . CONV_IMPLICIT ) ;
5665
+ rightType = this . currentType ;
5662
5666
5663
5667
// references must properly retain and release, with the same outcome independent of the branch taken
5664
5668
if ( leftType . isManaged ) {
0 commit comments