-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
permit NamedTuple{<:Any, Union{}} to be created
This is a NamedTuple where all of the fields exist but have type Union{}. It can be useful for initializing a typejoin in some cases, and unlike Tuple{Union{}} there are no problems with covariance that should be preventing it from existing. A few parameters of some constructors were adjusted for performance and correctness (mostly the former). Really just an edge case, since nobody should reasonably need a type that cannot be constructed, but it does seem to mildly improve the quality of some type queries such as these: ``` julia> fieldtype(NamedTuple{(:a, :b), T} where T<:Union{}, :a) was: ERROR: TypeError: in fieldtype, expected DataType, got Type{Union{}} now: Union{} julia> fieldtypes(NamedTuple{(:a, :b), T} where T<:Union{}) was: ERROR: TypeError: in fieldtype, expected DataType, got Type{Union{}} now: (Union{}, Union{}) ``` Note that `NamedTuple{(), Union{}}` is disallowed still, as that `Union{}` implies that the generating `Tuple` had least one field.
- Loading branch information
Showing
6 changed files
with
41 additions
and
20 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