@@ -5541,11 +5541,11 @@ export class Compiler extends DiagnosticEmitter {
55415541 let rightFlow = flow . fork ( ) ;
55425542 this . currentFlow = rightFlow ;
55435543 rightFlow . inheritNonnullIfTrue ( leftExpr ) ;
5544- rightExpr = this . compileExpression ( right , leftType , inheritedConstraints | Constraints . CONV_IMPLICIT ) ;
5545- rightType = leftType ;
55465544
55475545 // simplify if only interested in true or false
55485546 if ( contextualType == Type . bool || contextualType == Type . void ) {
5547+ rightExpr = this . compileExpression ( right , leftType , inheritedConstraints ) ;
5548+ rightType = this . currentType ;
55495549 rightExpr = this . performAutoreleasesWithValue ( rightFlow , rightExpr , rightType ) ;
55505550 rightFlow . freeScopedLocals ( ) ;
55515551 this . currentFlow = flow ;
@@ -5557,6 +5557,8 @@ export class Compiler extends DiagnosticEmitter {
55575557 this . currentType = Type . bool ;
55585558
55595559 } else {
5560+ rightExpr = this . compileExpression ( right , leftType , inheritedConstraints | Constraints . CONV_IMPLICIT ) ;
5561+ rightType = this . currentType ;
55605562
55615563 // references must properly retain and release, with the same outcome independent of the branch taken
55625564 if ( leftType . isManaged ) {
@@ -5643,11 +5645,11 @@ export class Compiler extends DiagnosticEmitter {
56435645 let rightFlow = flow . fork ( ) ;
56445646 this . currentFlow = rightFlow ;
56455647 rightFlow . inheritNonnullIfFalse ( leftExpr ) ;
5646- rightExpr = this . compileExpression ( right , leftType , inheritedConstraints | Constraints . CONV_IMPLICIT ) ;
5647- rightType = leftType ;
56485648
56495649 // simplify if only interested in true or false
56505650 if ( contextualType == Type . bool || contextualType == Type . void ) {
5651+ rightExpr = this . compileExpression ( right , leftType , inheritedConstraints ) ;
5652+ rightType = this . currentType ;
56515653 rightExpr = this . performAutoreleasesWithValue ( rightFlow , rightExpr , leftType ) ;
56525654 rightFlow . freeScopedLocals ( ) ;
56535655 this . currentFlow = flow ;
@@ -5659,6 +5661,8 @@ export class Compiler extends DiagnosticEmitter {
56595661 this . currentType = Type . bool ;
56605662
56615663 } else {
5664+ rightExpr = this . compileExpression ( right , leftType , inheritedConstraints | Constraints . CONV_IMPLICIT ) ;
5665+ rightType = this . currentType ;
56625666
56635667 // references must properly retain and release, with the same outcome independent of the branch taken
56645668 if ( leftType . isManaged ) {
0 commit comments