angular/packages/compiler-cli/src/ngtsc
Alex Rickabaugh 718d7fe5fe fix(ivy): properly parenthesize ternary expressions when emitted (#34221)
Previously, ternary expressions were emitted as:

condExpr ? trueCase : falseCase

However, this causes problems when ternary operations are nested. In
particular, a template expression of the form:

a?.b ? c : d

would have compiled to:

a == null ? null : a.b ? c : d

The ternary operator is right-associative, so that expression is interpreted
as:

a == null ? null : (a.b ? c : d)

when in reality left-associativity is desired in this particular instance:

(a == null ? null : a.b) ? c : d

This commit adds a check in the expression translator to detect such
left-associative usages of ternaries and to enforce such associativity with
parentheses when necessary.

A test is also added for the template type-checking expression translator,
to ensure it correctly produces right-associative expressions for ternaries
in the user's template.

Fixes #34087

PR Close #34221
2019-12-06 13:01:48 -08:00
..
annotations refactor(compiler): i18n - render legacy i18n message ids (#34135) 2019-12-03 10:15:53 -08:00
cycles refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
diagnostics fix(ngcc): do not output duplicate ɵprov properties (#34085) 2019-11-27 12:46:37 -08:00
entry_point refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
file_system test(ivy): support chdir() on the compiler's filesystem abstraction (#33828) 2019-11-19 12:41:24 -08:00
imports fix(ivy): emit fs-relative paths when rootDir(s) aren't in effect (#33828) 2019-11-19 12:41:24 -08:00
incremental fix(ivy): track changes across failed builds (#33971) 2019-11-22 17:39:35 -05:00
indexer fix(ivy): support abstract directives in template type checking (#33131) 2019-10-24 12:44:30 -07:00
metadata fix(ivy): support abstract directives in template type checking (#33131) 2019-10-24 12:44:30 -07:00
partial_evaluator fix(ivy): avoid infinite recursion when evaluation source files (#33772) 2019-11-20 14:51:37 -08:00
perf refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
reflection fix(ngcc): handle new __spreadArrays tslib helper (#33617) 2019-11-06 19:43:07 +00:00
routing build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#28871) 2019-02-28 12:06:36 -08:00
scope fix(ivy): always re-analyze the program during incremental rebuilds (#33862) 2019-11-20 11:46:02 -08:00
shims fix(compiler-cli): Pass SourceFile to getFullText() (#33660) 2019-11-07 16:47:07 -08:00
switch build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#28871) 2019-02-28 12:06:36 -08:00
testing refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
transform fix(ivy): add flag to skip non-exported classes (#33921) 2019-11-25 16:36:44 -05:00
translator fix(ivy): properly parenthesize ternary expressions when emitted (#34221) 2019-12-06 13:01:48 -08:00
typecheck fix(ivy): properly parenthesize ternary expressions when emitted (#34221) 2019-12-06 13:01:48 -08:00
util feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
program.ts refactor(compiler): i18n - render legacy i18n message ids (#34135) 2019-12-03 10:15:53 -08:00
resource_loader.ts fix(ivy): handle rooted resource paths correctly (#31511) 2019-07-11 11:42:33 -04:00
synthetic_files_compiler_host.ts feat: add support for TypeScript 3.3 (and drop older versions) (#29004) 2019-03-13 10:38:37 -07:00
tsc_plugin.ts refactor(ivy): use ClassDeclaration in more ReflectionHost methods (#29209) 2019-03-21 22:20:23 +00:00