Skip to content

flip sides source and target when we check signature relations #7328

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

Merged
merged 1 commit into from
Mar 2, 2016

Conversation

vladima
Copy link
Contributor

@vladima vladima commented Mar 1, 2016

and report errors during contravariant check. This is partial rollback of 5e69332 that introduced perf regressions #7293, #7082.

Note: errors in baselines has changed but personally I like new errors more since they more accurately reflect runtime behavior. I.e.

let a: (s: string) => void;
let b: (s: number) => void;
a = b;
// a("42");

used to be

t.ts(3,1): error TS2322: Type '(s: number) => void' is not assignable to type '(s: string) => void'.
  Types of parameters 's' and 's' are incompatible.
    Type 'number' is not assignable to type 'string'.

now

t.ts(3,1): error TS2322: Type '(s: number) => void' is not assignable to type '(s: string) => void'.
  Types of parameters 's' and 's' are incompatible.
    Type 'string' is not assignable to type 'number'.

In runtime a will have argument of type string that is not assignable to type number that is expected by b and this is exactly what is said in new error message.

@mhegazy
Copy link
Contributor

mhegazy commented Mar 2, 2016

👍

2 similar comments
@DanielRosenwasser
Copy link
Member

👍

@RyanCavanaugh
Copy link
Member

👍

vladima added a commit that referenced this pull request Mar 2, 2016
flip sides source and target when we check signature relations
@vladima vladima merged commit f34dcdd into master Mar 2, 2016
vladima added a commit that referenced this pull request Mar 3, 2016
@vladima vladima deleted the flipSidesInSignatureCheck branch March 14, 2016 03:54
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants