Can't use first type parameter as type bound for second parameter
Open
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Shouldn't flow complain in the following example that Bar is not a Foo?
https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVUCuA7AxgFwEs5swBzAU2woCdDcAeAFQBowBVALjCYD4AKfN1ZhM3dgEpuAfnZgA3qjBgaFfJhqlsmGDADcqAL7p8ATwAOFMADE4cMAF4FAHyVgAHt20BbAEa1UZ2NUM0swACEAQxpHFzdTL0w-AKD0XBIAZ3wwKDtuW3sneQ9uAEYwY3TsLLBfaO4omKKwBLAAJgq0zOy6gC8ZRtjKajpcfly4NjqaCVQgA
```javascript
/* @flow */
function generic(t: T, u: U): ?U {
return null;
}
type Foo = {|
x: number
|}
type Bar = {|
y: number
|}
const foo: Foo = { x: 1 }
const bar: Bar = { y: 2 }
const baz: ?Bar = generic(foo, bar)
```
Contributor guide
Assessment
This issue has not been assessed yet.