Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler-cli): support hasInvalidatedResolutions. #47585

Closed
wants to merge 1 commit into from

Conversation

mprobst
Copy link
Contributor

@mprobst mprobst commented Sep 29, 2022

The latest TypeScript compiler exposes the previously private field hasInvalidatedResolutions. That breaks Angular in the newer TS, because the new field would be required on DelegatingCompilerHost. However we cannot just add the field here, because it's not present in the older compiler.

This change adds the field for delegation, which works at runtime because the field is present. It suppresses the compiler error using a // @ts-expect-error, which should be removed once Angular moves to a TSC version that includes this change.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Doesn't compile with the latest tsc.

Issue Number: N/A

What is the new behavior?

Compiles with the latest tsc.

Does this PR introduce a breaking change?

  • Yes
  • No

@pullapprove pullapprove bot requested a review from atscott September 29, 2022 13:41
@atscott atscott requested review from crisbeto and removed request for atscott September 29, 2022 16:49
@pullapprove pullapprove bot requested a review from atscott September 29, 2022 16:49
@mprobst
Copy link
Contributor Author

mprobst commented Sep 29, 2022

@crisbeto @atscott can you help me with the test failure? Here's the error log:

(node:27197) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[2022-09-29T13:56:26.941Z]  "GET /" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/91.0.4472.0 Safari/537.36"
(node:27384) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
[2022-09-29T13:56:26.957Z]  "GET /npm/node_modules/zone.js/bundles/zone.umd.min.js" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/91.0.4472.0 Safari/537.36"
[2022-09-29T13:56:26.959Z]  "GET /bundle.min.js" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/91.0.4472.0 Safari/537.36"
F

Failures:
1) angular example application should display: Hello World!
  Message:
    Failed: script timeout
      (Session info: headless chrome=91.0.4472.0)
      (Driver info: chromedriver=91.0.4472.0 (3d60439cfb36485e76a1c5bb7f513d3721b20da1-refs/heads/master@{#870763}),platform=Linux 5.13.0-1023-aws x86_64)
  Stack:
    ScriptTimeoutError: script timeout
      (Session info: headless chrome=91.0.4472.0)
      (Driver info: chromedriver=91.0.4472.0 (3d60439cfb36485e76a1c5bb7f513d3721b20da1-refs/heads/master@{#870763}),platform=Linux 5.13.0-1023-aws x86_64)
        at Object.checkLegacyResponse (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/error.js:546:15)
        at parseHttpResponse (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/http.js:509:13)
        at /home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/http.js:441:30
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
    From: Task: Protractor.waitForAngular() - Locator: By(css selector, div)
        at Driver.schedule (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
        at ProtractorBrowser.executeAsyncScript_ (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/protractor/built/browser.js:423:28)
        at /home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/protractor/built/browser.js:454:33
        at ManagedPromise.invokeCallback_ (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/promise.js:1376:14)
        at TaskQueue.execute_ (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/promise.js:3084:14)
        at TaskQueue.executeNext_ (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/promise.js:3067:27)
        at /home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/promise.js:2927:27
        at /home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/promise.js:668:7
        at processTicksAndRejections (node:internal/process/task_queues:96:5)Error
        at ElementArrayFinder.applyAction_ (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/protractor/built/element.js:459:27)
        at ElementArrayFinder.<computed> [as getText] (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/protractor/built/element.js:91:29)
        at ElementFinder.<computed> [as getText] (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/protractor/built/element.js:831:22)
        at UserContext.<anonymous> (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/test/e2e/app.spec.ts:9:9)
        at /home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/jasminewd2/index.js:108:15
        at new ManagedPromise (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/promise.js:1077:7)
        at ControlFlow.promise (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/promise.js:2505:12)
        at schedulerExecute (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/jasminewd2/index.js:95:18)
        at TaskQueue.execute_ (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/promise.js:3084:14)
        at TaskQueue.executeNext_ (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/selenium-webdriver/lib/promise.js:3067:27)
    From: Task: Run it("should display: Hello World!") in control flow
        at UserContext.<anonymous> (/home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/_tmp/8cdc3029f2eb0e6151c36ea1e5e293f2/_bazel_circleci/e4ceea6415dd3abdb331f8d5f44d98f4/sandbox/processwrapper-sandbox/73/execroot/bazel_ngtsc_plugin/bazel-out/k8-fastbuild/bin/test/e2e/test_chromium-local.sh.runfiles/npm/node_modules/jasminewd2/index.js:94:19)

That sounds like it's very unlikely to be caused by my change?

@crisbeto
Copy link
Member

That's just a flaky test. I've restarted it.

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release area: compiler Issues related to `ngc`, Angular's template compiler labels Oct 4, 2022
@ngbot ngbot bot modified the milestone: Backlog Oct 4, 2022
The latest TypeScript compiler exposes the previously private field
`hasInvalidatedResolutions`. That breaks Angular in the newer TS,
because the new field would be required on DelegatingCompilerHost.
However we cannot just add the field here, because it's not present in
the older compiler.

This change adds the field for delegation, which works at runtime
because the field is present. It suppresses the compiler error using a
`// @ts-expect-error`, which should be removed once Angular moves to a
TSC version that includes this change.
@atscott atscott added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 4, 2022
@AndrewKushnir AndrewKushnir added the action: presubmit The PR is in need of a google3 presubmit label Oct 4, 2022
@crisbeto crisbeto removed the action: presubmit The PR is in need of a google3 presubmit label Oct 4, 2022
@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit 2e1ddde.

yharaskrik pushed a commit to yharaskrik/angular that referenced this pull request Oct 5, 2022
The latest TypeScript compiler exposes the previously private field
`hasInvalidatedResolutions`. That breaks Angular in the newer TS,
because the new field would be required on DelegatingCompilerHost.
However we cannot just add the field here, because it's not present in
the older compiler.

This change adds the field for delegation, which works at runtime
because the field is present. It suppresses the compiler error using a
`// @ts-expect-error`, which should be removed once Angular moves to a
TSC version that includes this change.

PR Close angular#47585
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants