-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
non termination of calls to polymorphic functions
Summary: Various outstanding reports of non-termination had the same root cause: we were not caching instantiations when executing calls to polymorphic functions, which led to cycles where different instantiations would continue to spew different-looking, but ultimately redundant, constraints. We already solve a similar problem with method calls on type applications. Here we start from the same solution, but need to extend and tweak it a bit to make it work. Reviewed By: samwgoldman Differential Revision: D4521320 fbshipit-source-id: e074af41546b3c4d1ad38fb181062c3f347099f6
- Loading branch information
1 parent
a6f8432
commit 3e4d589
Showing
17 changed files
with
202 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ignore] | ||
|
||
[include] | ||
|
||
[libs] | ||
lib | ||
|
||
[options] | ||
no_flowlib=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Found 0 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
declare class Array<T> { | ||
@@iterator(): Iterator<T>; | ||
map<U>(callbackfn: (value: T, index: number, array: Array<T>) => U, thisArg?: any): Array<U>; | ||
} | ||
|
||
type IteratorResult<Yield,Return> = | ||
| { done: true, value?: Return } | ||
| { done: false, value: Yield }; | ||
|
||
interface $Iterator<+Yield,+Return,-Next> { | ||
@@iterator(): $Iterator<Yield,Return,Next>; | ||
next(value?: Next): IteratorResult<Yield,Return>; | ||
} | ||
type Iterator<+T> = $Iterator<T,void,void>; | ||
|
||
interface $Iterable<+Yield,+Return,-Next> { | ||
@@iterator(): $Iterator<Yield,Return,Next>; | ||
} | ||
type Iterable<+T> = $Iterable<T,void,void>; | ||
|
||
declare class Map<K, V> { | ||
@@iterator(): Iterator<[K, V]>; | ||
constructor(iterable: ?Iterable<[K, V]>): void; | ||
set(key: K, value: V): Map<K, V>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
declare module "immutable" { | ||
declare class Map<K,V> { | ||
static <K,V>(iter: Iterator<[K,V]>): Map<K,V>; | ||
static <K:string,V>(object: {+[k:K]:V}): Map<K,V>; | ||
|
||
set(key: K, value: V): this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// @flow | ||
|
||
const Immutable = require('immutable'); | ||
|
||
const tasksPerStatusMap = new Map( | ||
[].map(taskStatus => [taskStatus, new Map()]), | ||
); | ||
for (let [taskStatus, tasksMap] of tasksPerStatusMap) { | ||
tasksPerStatusMap.set(taskStatus, Immutable.Map(tasksMap)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* @flow */ | ||
|
||
declare class Bar<K> { | ||
update<K_>(updater: (value: this) => Bar<K_>): Bar<K_>; | ||
} | ||
|
||
declare function foo<U>( | ||
initialValue: U, | ||
callbackfn: (previousValue: U) => U | ||
): U; | ||
|
||
declare var items: Bar<string>; | ||
declare var updater: (value: Bar<string>) => Bar<string>; | ||
|
||
foo( | ||
items, | ||
(acc) => acc.update(updater) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// @flow | ||
|
||
declare class ImmBox<T> { | ||
static <U>(x: any): ImmBox<U>; | ||
static (x: any): any; | ||
} | ||
|
||
declare class Box<T> { | ||
constructor(x: T): void; | ||
set(value: T): void; | ||
get(): T; | ||
} | ||
|
||
const outer = new Box(); | ||
const inner = outer.get(); | ||
outer.set(ImmBox(inner)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ignore] | ||
|
||
[include] | ||
|
||
[libs] | ||
lib | ||
|
||
[options] | ||
no_flowlib=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Found 0 errors |
Oops, something went wrong.