Skip to content

Conversation

@rfourquet
Copy link
Member

@rfourquet rfourquet commented Dec 8, 2018

This fixes a bug in union! leading to currently having Set([nothing, true, false]) having only two elements :(

@rfourquet rfourquet added collections Data structures holding multiple items, e.g. sets embarrassing-bugfix Whoops! backport pending 0.7 labels Dec 8, 2018
@rfourquet rfourquet added this to the 1.1 milestone Dec 8, 2018
@KristofferC KristofferC mentioned this pull request Dec 9, 2018
52 tasks
@rfourquet rfourquet force-pushed the rf/union-fix-max_values branch from c796054 to 6a904e8 Compare December 9, 2018 11:05
# saturated addition to prevent overflow with typemax(Int)
max_values(T::Union) = max(max_values(T.a), max_values(T.b), max_values(T.a) + max_values(T.b))
max_values(::Type{Bool}) = 2
max_values(::Type{Nothing}) = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be applied to all singleton types? You can check whether a type is a singleton using isdefined(T, :instance) (there's an issingletontype helper function for this in replace.jl).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes seems like a good idea!
As CI is green and I think this is an urgent fix to have, I will merge as-is later today and implement your idea (which is not directly related to the bugfix) separately.

@JeffBezanson JeffBezanson merged commit f49cb42 into master Dec 11, 2018
@JeffBezanson JeffBezanson deleted the rf/union-fix-max_values branch December 11, 2018 22:39
KristofferC pushed a commit that referenced this pull request Dec 12, 2018
KristofferC pushed a commit that referenced this pull request Dec 30, 2018
@KristofferC KristofferC mentioned this pull request Dec 30, 2018
53 tasks
@StefanKarpinski StefanKarpinski added triage This should be discussed on a triage call backport 1.0 and removed triage This should be discussed on a triage call labels Jan 31, 2019
@JeffBezanson JeffBezanson removed triage This should be discussed on a triage call triage backport pending 1.0 labels Jan 31, 2019
KristofferC pushed a commit that referenced this pull request Feb 4, 2019
@KristofferC KristofferC mentioned this pull request Feb 4, 2019
39 tasks
KristofferC pushed a commit that referenced this pull request Feb 11, 2019
KristofferC pushed a commit that referenced this pull request Apr 20, 2019
@KristofferC KristofferC added the bugfix This change fixes an existing bug label May 16, 2019
@KristofferC KristofferC mentioned this pull request Aug 26, 2019
55 tasks
KristofferC pushed a commit that referenced this pull request Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug collections Data structures holding multiple items, e.g. sets embarrassing-bugfix Whoops!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants