Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop redundant Widen operator from RHS of subtyping rule #130

Open
wants to merge 1 commit into
base: release
Choose a base branch
from

Conversation

nikitabobko
Copy link
Member

Statement 1. if (Widen(X) <: Widen(Y)) is true expression then Widen(X) <: Y stays true expression

Statement 2. There is no such X and Y that the both following expressions evaluate to true

Widen(X) <: Widen(Y) is false
Widen(X) <: Y        is true

In general case, statement 2 is not valid. In our specific case where Widen is defined the way it's defined, statement 2 is valid

Given that in our case statement 1 and statement 2 are both valid, Widen is redundant in the RHS and confuses readers

Informally: the intention is to make the widened type more appealing for
the overload resolution, so only LHS should be widened

Statement 1: if (Widen(X) <: Widen(Y)) is true expression then Widen(X) <: Y stays true expression

Statement 2: There is no such X and Y that the both following expressions evaluate to true
    Widen(X) <: Widen(Y) is false
    Widen(X) <: Y        is true

In general case, statement 2 is not valid
In our specific case where Widen is defined the way it's defined,
statement 2 is valid

Given that in our case statement 1 and statement 2 are both valid, Widen
is redundant in the RHS and confuses readers

Informally: the intention is to make the widened type more appealing for
the overload resolution, so only LHS should be widened
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant