-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #575 input type mismatch erroring
The problem here was that when we pushed materializers we introduced a regression where somehow input node types got treated differently. The bug here was that "input" nodes are created at add dependency time, thus if two functions request the same input, but provide different types things would correctly error, but in this case in #575 the types were compatible. So the design choice here was to: 1. Check that if one is the subset of the other, then we allow it. 2. We then make the subset type the type of the node. 3. We attach originating functions to ensure we can create a good error message. This has the side-effect of propagating all the way through to Variables and such. 4. The mutating node functions are scoped to only work if the Node is deemed External, that way we don't use that code path inadvertently in the future. 5. We fix an assumption in visualization that assumed inputs didn't have functions. Note: the input/external/user-defined node creation should really be pulled out into a separate step, and not created dynamically in the add_dependency part.
- Loading branch information
Showing
6 changed files
with
270 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from typing import Union | ||
|
||
|
||
def b(a: Union[int, str]) -> int: | ||
return a | ||
|
||
|
||
def c(a: str) -> str: | ||
return a | ||
|
||
|
||
def d(a: str) -> str: | ||
return a |
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,17 @@ | ||
from typing import Union | ||
|
||
|
||
def b(a: int) -> int: | ||
return a | ||
|
||
|
||
def c(a: str) -> str: | ||
return a | ||
|
||
|
||
def e(d: Union[int, str]) -> int: | ||
return d | ||
|
||
|
||
def f(d: Union[float, int]) -> float: | ||
return d |
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