facebook / facebook/flow

Class types imported via Windows symlinks are considered different types

Open
#7,542 0 comments 0 reactions 0 assignees View on GitHub
bug Windows support
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Flow version: 0.93

## Expected behavior
Types are compatible.

## Actual behavior
Types are not compatible.

Hi Flow friends! 👋

It seems that importing a class type via a symlink on Windows is considered different than importing that same class via its realpath. Flow complains that the types are not compatible.

This is not the case on Mac or Linux, and Node is able to correctly resolve this class at runtime across all three platforms.

I've created a minimal reproduction over at https://github.com/wbinnssmith/flow-windows-symlink

To run it, first run `yarn`, then `yarn flow-node index.js` to verify that at runtime these classes are the same. This uses equality of the class/constructor but `instanceof` also proves that two objects were constructed by the same class.

On Windows `yarn flow` does not pass, while it does on other platforms. On Windows, you receive this:

```js

Error ----------------------------------------------------------------------------------------------- test/index.js:7:14

Cannot assign `a1` to `a2` because `A` [1] is incompatible with `A` [2].

test/index.js:7:14
7| let a2: A2 = a1;
^^

References:
test/index.js:6:9
6| let a1: A1 = new A1();
^^ [1]
test/index.js:7:9
7| let a2: A2 = a1;
^^ [2]
```

* Link to Try-Flow or Github repo: https://github.com/wbinnssmith/flow-windows-symlink

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.