Skip to content

Commit

Permalink
[flow] Fix implicit instantiation test
Browse files Browse the repository at this point in the history
Summary:
This error was introduced in D55456495, however the test case is not meant to error, it was just incorrect in passing in `interface {}`. Fix the test case.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D57389641

fbshipit-source-id: 6fa9ee9c7d2fb59060a4e25a22ae92e87187829c
  • Loading branch information
gkz authored and facebook-github-bot committed May 15, 2024
1 parent 622ef38 commit f2888b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
18 changes: 1 addition & 17 deletions tests/contextual_typing/contextual_typing.exp
Original file line number Diff line number Diff line change
Expand Up @@ -538,22 +538,6 @@ References:
^^^^ [1]


Error --------------------------------------------------------------------------------- implicit_instantiation.js:211:21

Cannot instantiate `Record` because interface type [1] is not a subtype of object type [2]. Class instances are not
subtypes of object types; consider rewriting object type [2] as an interface in type argument `T`.
[class-object-subtyping]

implicit_instantiation.js:211:21
211| records: Record<interface {}>,
^^^^^^^^^^^^ [1]

References:
implicit_instantiation.js:203:18
203| type Record<T: {...}> = { ...T, ... };
^^^^^ [2]


Error -------------------------------------------------------------------------------------------- intersections.js:7:24

Cannot cast `x` to number because string [1] is incompatible with number [2]. [incompatible-cast]
Expand Down Expand Up @@ -1262,4 +1246,4 @@ References:



Found 91 errors
Found 90 errors
2 changes: 1 addition & 1 deletion tests/contextual_typing/implicit_instantiation.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function test20() {

const result: (
value: mixed,
records: Record<interface {}>,
records: Record<{...}>,
) => any = fn((value, records) => 42); // okay
}

Expand Down

0 comments on commit f2888b0

Please sign in to comment.