-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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 dependency order and observer registration #41253
Conversation
@@ -84,7 +84,7 @@ namespace ts { | |||
performance.mark(end); | |||
} | |||
performance.measure(name, start, end); | |||
if (end = "__performance.measure-fix__") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... Should we have a lint for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or a --strictBoolean
(or --pedanticBoolean
?) flag that requires all conditions be boolean
(including !
). It wouldn't catch if (f = true)
, but it also would mean you'd have to write a lot of if (obj !== null && obj !== undefined)
instead of if (obj)
because !!obj
would also be a violation...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while (next = read())
seems like a sane pattern, so this feels more like a heuristic than a compiler error. Having said that, I would probably personally use such a mode, assuming it had a (totally reasonable) exception for !!expr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, mostly just using =
in an if
without a reference to the assigned variable within the if
. (Since I know we do this intentionally in relationship checking, but the difference there is we actually reference the checked variable)
@@ -13,10 +13,10 @@ | |||
"corePublic.ts", | |||
"core.ts", | |||
"debug.ts", | |||
"semver.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need a comment so it doesn't get alphabetized back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should never be alphabetized, they are all order dependent.
Fixes a dependency ordering issue in #40593 and correctly handles that PerformanceObserver's callback is called each time a mark or measure is recorded, not just once.
These issues were detected when running perf tests on another PR.