-
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.
[flow] Scoped libdef support 4/n: Error on libdef name override
Summary: With the support for scoped libdefs, the problem of libdef override will be much more severe. Previously, it's just bad that we just forcefully replace one of the defined entries. Now with scoped libdefs where common code is checked only under common libdefs, a scoped libdef binding overriding a common libdef binding in an inconsistent way might create a false sense of security. Therefore, in this diff, we will now error on the overriding location as a first step, so that we can at least know where the override happens. We can relax this error later when we support more forms of declaration merging. To detect the name overrides, we intercept at the `bind` function. Whenever we see an illegal bind at the global scope level, we will report an error. I have updated all the updaters (those `f`s) to also return whether the binding is legal. Changelog: [errors] Overriding already defined names in library definition will now error. Reviewed By: panagosg7 Differential Revision: D70570824 fbshipit-source-id: 62e59e108143c5233367de626a1af98706bdc660
- Loading branch information
1 parent
9f8cd90
commit 10e2d16
Showing
22 changed files
with
249 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ lib | |
|
||
[options] | ||
all=true | ||
no_flowlib=true | ||
no_flowlib=false |
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ lib.js | |
|
||
[options] | ||
all=true | ||
no_flowlib=false |
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 |
---|---|---|
@@ -1,3 +0,0 @@ | ||
declare class Object { | ||
static freeze<T>(o: T): T; | ||
} | ||
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// The lib file is included twice, because it is included in both `lib` and | ||
// `lib/shared`, which are both listed in the `.flowconfig` | ||
declare var global_foo: number; | ||
declare var global_foo: number; // intentional-libdef-override |
Oops, something went wrong.