Runtime 'none' by default

This commit is contained in:
dcode
2019-04-09 08:28:14 +02:00
parent eb6c4c09ee
commit bb659bbdcd
31 changed files with 1253 additions and 1734 deletions

View File

@ -2890,7 +2890,7 @@ export class Compiler extends DiagnosticEmitter {
assert(!expression.toType);
let expr = this.compileExpressionRetainType(expression.expression, contextualType, WrapMode.NONE);
let type = this.currentType;
if (!type.is(TypeFlags.NULLABLE | TypeFlags.REFERENCE)) {
if (!type.is(TypeFlags.NULLABLE | TypeFlags.REFERENCE) || this.currentFlow.isNonnull(type, expr)) {
this.info(
DiagnosticCode.Expression_is_never_null,
expression.expression.range