Skip to content

Fix typos - #1

Merged
Eric Traut (erictraut) merged 1 commit into
microsoft:masterfrom
kinow:typos
Mar 24, 2019
Merged

Eric Traut (erictraut) merged 1 commit into
microsoft:masterfrom
kinow:typos

Conversation

@kinow

Copy link
Copy Markdown
Contributor

Fixes a few typos and indentation in a couple of files.

Thanks
Bruno

@msftclas

Microsoft Contribution License Agreements (msftclas) commented Mar 24, 2019 •

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@erictraut

Copy link
Copy Markdown
Collaborator

Cool! Thanks for the contribution.

@erictraut
Eric Traut (erictraut) merged commit 2a66f9c into microsoft:master Mar 24, 2019
Eric Traut (erictraut) pushed a commit that referenced this pull request Sep 4, 2019
Update link to VS Code extension in README.md
Mark Sujew (msujew) pushed a commit to TypeFox/pyright that referenced this pull request Mar 21, 2023
Uses an abstraction over Web Workers and worker_threads. A bit of a pain
due to transferList.

It requires a bit of a dance to create the Workers, particularly as
Safari has no nested worker support. Browser clients will need updating
to the new incantation.

Also adds minimal file system operations. These are a stop-gap solution.
Mark Sujew (msujew) pushed a commit to TypeFox/pyright that referenced this pull request Mar 29, 2023
Uses an abstraction over Web Workers and worker_threads. A bit of a pain
due to transferList.

It requires a bit of a dance to create the Workers, particularly as
Safari has no nested worker support. Browser clients will need updating
to the new incantation.

Also adds minimal file system operations. These are a stop-gap solution.
Eddie Bergman (eddiebergman) pushed a commit to eddiebergman/pyright that referenced this pull request Jan 20, 2024
David Foster (davidfstr) added a commit to davidfstr/pyright that referenced this pull request May 7, 2026
Squish to -> Do not try to interpret a string as a TypeForm unless one is expected
Rich Chiodo (rchiodo) pushed a commit that referenced this pull request Jun 25, 2026
* Enable TypeForm support by default

...rather than requiring the --enableExperimentalFeatures bit to be set

* Do not try to interpret a string as a TypeForm unless one is expected

...by the current interence context or because EvalFlags.TypeFormArg is set.

Without this optimization, the call5.py test fails where it defines a
NamedTuple "X", [("a", int), ...]. Attempting to interpret the string "a"
as a forward reference looks up the name `a` (bound by a later for-loop),
and the resulting flow analysis recursively re-enters the Z(...) constructor,
causing a "Class definition for Z depends on itself" error.

* Remove test-output.txt

Squish change to -> Do not try to interpret a string as a TypeForm unless one is expected

* AI Coding: Ignore /plan directory

* Prettier fixes #1

Squish to -> Do not try to interpret a string as a TypeForm unless one is expected

* Prettier fixes #2

Squish to -> Enable TypeForm support by default

* Revert "AI Coding: Ignore /plan directory"

This reverts commit 7233033.

* Squish -> Do not try to interpret a string as a TypeForm unless one is expected

* Add build/perfCompare.py: cross-commit type-check perf benchmark

Adds a dev-facing tool, adapted from mypy's misc/perf_compare.py, that
builds the production pyright CLI bundle at each of two or more commits and
times repeated runs over a fixed corpus, reporting robust winsorized paired
deltas vs a baseline. Supports wall or CPU-time metrics and single-file or
project corpora. Cached bundles live beside the script under
build/perfCompare/binaries/ (gitignored).

Also adds a brief pointer in CONTRIBUTING.md.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Verify TypeForm inference through container literals

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Use someSubtypes for short-circuit in expectedTypeWantsTypeForm

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Decline cloneWithTypeForm short-circuit: measured benefit negligible

Review feedback suggested short-circuiting cloneWithTypeForm with
`if (type.props?.typeForm === typeForm) return type;` (mirroring
cloneForCondition) to avoid allocations on the now-unconditional call
sites. After measuring, this is not worth doing: the no-op case occurs in
only ~0.2% of calls, so the guard would add a branch to the hot path while
saving almost no allocations. No code change is made.

The reference-equality check rarely holds because nearly every call site
passes a freshly-allocated value (e.g. convertToInstance(type)), which is a
new object every time. A value-equality check (isTypeSame) would catch more
cases but costs far more than the allocation it would save, so it is a net
loss on the hot path.

Supporting data (instrumented cloneWithTypeForm over the full
typeEvaluator jest suite, 1,162 tests):

    cloneWithTypeForm calls : ~12,000
    `=== typeForm` would fire:     23  (~0.2%)
      of which both undefined:     22  (~0.18%)
      non-undefined ref match:      1

So the general `=== typeForm` guard buys essentially nothing beyond the
both-undefined case, which is itself only ~0.18% of calls.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Drop enableExperimentalFeatures from TypeForm tests

Addresses review feedback: the TypeForm tests set enableExperimentalFeatures
= true, so none validated this PR's core claim that TypeForm is enabled by
default. Remove the flag from the existing TypeForm1-8 tests so they all
exercise the default configuration and directly prove the
isTypeFormSupported gate removal is effective.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Squish -> Do not try to interpret a string as a TypeForm unless one is expected

Fix prettier whitespace issue

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Khaleel Al-Adhami (adhami3310) added a commit to reflex-dev/pyright-go that referenced this pull request Sep 3, 2026
createNewType from typeEvaluator.ts and all of constructorTransform.ts;
also wires the dataclass converter to the now-real
createFunctionFromConstructor, closing the divergence noted three commits
back.

constructorTransform exists for exactly one class. functools.partial's
type as typeshed writes it cannot express what it does: partial(f, 1) is
callable with f's *remaining* parameters, which depends on both f's
signature and which arguments were bound. So the constructor's result is
rewritten with a __call__ synthesized for that specific application, and
the bound arguments are checked as they are consumed -- which is what
makes partial(f, "x") an error at the partial() call rather than at the
eventual invocation.

The rebuilt parameter list is reordered deliberately: unassigned first,
then bound keyword parameters, then **kwargs. A bound keyword parameter is
kept rather than dropped, because Python lets you override a partial's
keyword binding at the call; it gains a default so it need not be
resupplied, and moves after the unassigned ones so it stops occupying a
positional slot.

The sweep caught one bug, and it was hazard microsoft#1 from STATUS-STAGE-D.md
reintroduced by this commit's own code. createNewType returns a concrete
*ClassType where the previous stub returned a Type, so `ReturnType:
e.createNewType(...)` boxed a *typed nil* whenever it declined -- non-nil
as an interface value, and dereferenced by the first IsNever() downstream.
Two files panicked.

The lesson is narrower than "beware typed nil": giving a function a
concrete pointer return type is *itself* the hazard, because it converts
every `return nil` into a trap at every call site that widens it. The
original has no such trap, since `undefined` assigned to an optional field
stays undefined. Call sites now widen through an explicit helper.

Stage D gate: 1091 -> 1107 passed of 1279. Corpus clean: 1302 files, zero
panics, no hangs.
Khaleel Al-Adhami (adhami3310) added a commit to reflex-dev/pyright-go that referenced this pull request Sep 3, 2026
createNewType from typeEvaluator.ts and all of constructorTransform.ts;
also wires the dataclass converter to the now-real
createFunctionFromConstructor, closing the divergence noted three commits
back.

constructorTransform exists for exactly one class. functools.partial's
type as typeshed writes it cannot express what it does: partial(f, 1) is
callable with f's *remaining* parameters, which depends on both f's
signature and which arguments were bound. So the constructor's result is
rewritten with a __call__ synthesized for that specific application, and
the bound arguments are checked as they are consumed -- which is what
makes partial(f, "x") an error at the partial() call rather than at the
eventual invocation.

The rebuilt parameter list is reordered deliberately: unassigned first,
then bound keyword parameters, then **kwargs. A bound keyword parameter is
kept rather than dropped, because Python lets you override a partial's
keyword binding at the call; it gains a default so it need not be
resupplied, and moves after the unassigned ones so it stops occupying a
positional slot.

The sweep caught one bug, and it was hazard microsoft#1 from STATUS-STAGE-D.md
reintroduced by this commit's own code. createNewType returns a concrete
*ClassType where the previous stub returned a Type, so `ReturnType:
e.createNewType(...)` boxed a *typed nil* whenever it declined -- non-nil
as an interface value, and dereferenced by the first IsNever() downstream.
Two files panicked.

The lesson is narrower than "beware typed nil": giving a function a
concrete pointer return type is *itself* the hazard, because it converts
every `return nil` into a trap at every call site that widens it. The
original has no such trap, since `undefined` assigned to an optional field
stays undefined. Call sites now widen through an explicit helper.

Stage D gate: 1091 -> 1107 passed of 1279. Corpus clean: 1302 files, zero
panics, no hangs.
Khaleel Al-Adhami (adhami3310) added a commit to reflex-dev/pyright-go that referenced this pull request Sep 3, 2026
createNewType from typeEvaluator.ts and all of constructorTransform.ts;
also wires the dataclass converter to the now-real
createFunctionFromConstructor, closing the divergence noted three commits
back.

constructorTransform exists for exactly one class. functools.partial's
type as typeshed writes it cannot express what it does: partial(f, 1) is
callable with f's *remaining* parameters, which depends on both f's
signature and which arguments were bound. So the constructor's result is
rewritten with a __call__ synthesized for that specific application, and
the bound arguments are checked as they are consumed -- which is what
makes partial(f, "x") an error at the partial() call rather than at the
eventual invocation.

The rebuilt parameter list is reordered deliberately: unassigned first,
then bound keyword parameters, then **kwargs. A bound keyword parameter is
kept rather than dropped, because Python lets you override a partial's
keyword binding at the call; it gains a default so it need not be
resupplied, and moves after the unassigned ones so it stops occupying a
positional slot.

The sweep caught one bug, and it was hazard microsoft#1 from STATUS-STAGE-D.md
reintroduced by this commit's own code. createNewType returns a concrete
*ClassType where the previous stub returned a Type, so `ReturnType:
e.createNewType(...)` boxed a *typed nil* whenever it declined -- non-nil
as an interface value, and dereferenced by the first IsNever() downstream.
Two files panicked.

The lesson is narrower than "beware typed nil": giving a function a
concrete pointer return type is *itself* the hazard, because it converts
every `return nil` into a trap at every call site that widens it. The
original has no such trap, since `undefined` assigned to an optional field
stays undefined. Call sites now widen through an explicit helper.

Stage D gate: 1091 -> 1107 passed of 1279. Corpus clean: 1302 files, zero
panics, no hangs.
Khaleel Al-Adhami (adhami3310) added a commit to reflex-dev/pyright-go that referenced this pull request Sep 3, 2026
createNewType from typeEvaluator.ts and all of constructorTransform.ts;
also wires the dataclass converter to the now-real
createFunctionFromConstructor, closing the divergence noted three commits
back.

constructorTransform exists for exactly one class. functools.partial's
type as typeshed writes it cannot express what it does: partial(f, 1) is
callable with f's *remaining* parameters, which depends on both f's
signature and which arguments were bound. So the constructor's result is
rewritten with a __call__ synthesized for that specific application, and
the bound arguments are checked as they are consumed -- which is what
makes partial(f, "x") an error at the partial() call rather than at the
eventual invocation.

The rebuilt parameter list is reordered deliberately: unassigned first,
then bound keyword parameters, then **kwargs. A bound keyword parameter is
kept rather than dropped, because Python lets you override a partial's
keyword binding at the call; it gains a default so it need not be
resupplied, and moves after the unassigned ones so it stops occupying a
positional slot.

The sweep caught one bug, and it was hazard microsoft#1 from STATUS-STAGE-D.md
reintroduced by this commit's own code. createNewType returns a concrete
*ClassType where the previous stub returned a Type, so `ReturnType:
e.createNewType(...)` boxed a *typed nil* whenever it declined -- non-nil
as an interface value, and dereferenced by the first IsNever() downstream.
Two files panicked.

The lesson is narrower than "beware typed nil": giving a function a
concrete pointer return type is *itself* the hazard, because it converts
every `return nil` into a trap at every call site that widens it. The
original has no such trap, since `undefined` assigned to an optional field
stays undefined. Call sites now widen through an explicit helper.

Stage D gate: 1091 -> 1107 passed of 1279. Corpus clean: 1302 files, zero
panics, no hangs.
Khaleel Al-Adhami (adhami3310) added a commit to reflex-dev/pyright-go that referenced this pull request Sep 3, 2026
createNewType from typeEvaluator.ts and all of constructorTransform.ts;
also wires the dataclass converter to the now-real
createFunctionFromConstructor, closing the divergence noted three commits
back.

constructorTransform exists for exactly one class. functools.partial's
type as typeshed writes it cannot express what it does: partial(f, 1) is
callable with f's *remaining* parameters, which depends on both f's
signature and which arguments were bound. So the constructor's result is
rewritten with a __call__ synthesized for that specific application, and
the bound arguments are checked as they are consumed -- which is what
makes partial(f, "x") an error at the partial() call rather than at the
eventual invocation.

The rebuilt parameter list is reordered deliberately: unassigned first,
then bound keyword parameters, then **kwargs. A bound keyword parameter is
kept rather than dropped, because Python lets you override a partial's
keyword binding at the call; it gains a default so it need not be
resupplied, and moves after the unassigned ones so it stops occupying a
positional slot.

The sweep caught one bug, and it was hazard microsoft#1 from STATUS-STAGE-D.md
reintroduced by this commit's own code. createNewType returns a concrete
*ClassType where the previous stub returned a Type, so `ReturnType:
e.createNewType(...)` boxed a *typed nil* whenever it declined -- non-nil
as an interface value, and dereferenced by the first IsNever() downstream.
Two files panicked.

The lesson is narrower than "beware typed nil": giving a function a
concrete pointer return type is *itself* the hazard, because it converts
every `return nil` into a trap at every call site that widens it. The
original has no such trap, since `undefined` assigned to an optional field
stays undefined. Call sites now widen through an explicit helper.

Stage D gate: 1091 -> 1107 passed of 1279. Corpus clean: 1302 files, zero
panics, no hangs.
Khaleel Al-Adhami (adhami3310) added a commit to reflex-dev/pyright-go that referenced this pull request Sep 3, 2026
createNewType from typeEvaluator.ts and all of constructorTransform.ts;
also wires the dataclass converter to the now-real
createFunctionFromConstructor, closing the divergence noted three commits
back.

constructorTransform exists for exactly one class. functools.partial's
type as typeshed writes it cannot express what it does: partial(f, 1) is
callable with f's *remaining* parameters, which depends on both f's
signature and which arguments were bound. So the constructor's result is
rewritten with a __call__ synthesized for that specific application, and
the bound arguments are checked as they are consumed -- which is what
makes partial(f, "x") an error at the partial() call rather than at the
eventual invocation.

The rebuilt parameter list is reordered deliberately: unassigned first,
then bound keyword parameters, then **kwargs. A bound keyword parameter is
kept rather than dropped, because Python lets you override a partial's
keyword binding at the call; it gains a default so it need not be
resupplied, and moves after the unassigned ones so it stops occupying a
positional slot.

The sweep caught one bug, and it was hazard microsoft#1 from STATUS-STAGE-D.md
reintroduced by this commit's own code. createNewType returns a concrete
*ClassType where the previous stub returned a Type, so `ReturnType:
e.createNewType(...)` boxed a *typed nil* whenever it declined -- non-nil
as an interface value, and dereferenced by the first IsNever() downstream.
Two files panicked.

The lesson is narrower than "beware typed nil": giving a function a
concrete pointer return type is *itself* the hazard, because it converts
every `return nil` into a trap at every call site that widens it. The
original has no such trap, since `undefined` assigned to an optional field
stays undefined. Call sites now widen through an explicit helper.

Stage D gate: 1091 -> 1107 passed of 1279. Corpus clean: 1302 files, zero
panics, no hangs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants