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

Consistently parse A <: B as a Expr(:comparison, A, :(<:), B) #9582

Closed
wants to merge 1 commit into from

Conversation

jakebolewski
Copy link
Member

Should fix #9503

This is a backwards incompatible change, note that before

type A <: B
end

would be parsed as:

Expr(:type, true, Expr(:(<:), :A, :B), Expr(:block,))

now it is parsed as

Expr(:type, true, Expr(:comparison, :A, :(<:), :B), Expr(:block,))

chained subtype comparisons for type/immutable are still disallowed

type A <: B <: C
end

Should fix #9503

This is a backwards incompatible change, note that before
```julia
type A <: B
end
```

would be parsed as:
```julia
Expr(:type, true, Expr(:(<:), :A, :B), Expr(:block,))
```

now it is parsed as
```julia
Expr(:type, true, Expr(:comparison, :A, :(<:), :B), Expr(:block,))
```

chained subtype comparisons for type/immutable are still disallowed
```julia
type A <: B <: C
end
```
@jakebolewski jakebolewski added the breaking This change will break code label Jan 3, 2015
@@ -972,9 +974,9 @@
(values name '() 'Any)) ex)
((pattern-lambda (curly (-- name (-s)) . params)
(values name params 'Any)) ex)
((pattern-lambda (|<:| (-- name (-s)) super)
((pattern-lambda (comparison (-- name (-s)) <: super)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Needs to be (-/ <:) to make it match a literal <:. Otherwise <: is a pattern variable like other symbols.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, failure to match this pattern is the reason this worked at all. Thanks.

@JeffBezanson
Copy link
Sponsor Member

The <: in these contexts is never evaluated, so it doesn't matter.

@jakebolewski jakebolewski deleted the jcb/9503 branch February 25, 2015 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

produce only one Expr type from A <: B expressions
2 participants