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

Circular parametric types #14825

Closed
thofma opened this issue Jan 28, 2016 · 0 comments
Closed

Circular parametric types #14825

thofma opened this issue Jan 28, 2016 · 0 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@thofma
Copy link
Contributor

thofma commented Jan 28, 2016

In continuation from https://groups.google.com/forum/#!topic/julia-users/bYPdJSUq_9g

I am trying to define two parametric types with circular dependency as follows (julia version 0.4.2):

abstract abstest

type t1{A <: abstest, B} 
  x::A 
  y::B
end

type t2{C, B} <: abstest 
  x::C 
  y::t1{t2{C, B}, B}
end

Unfortunately it doesn't work:

ERROR: TypeError: t1: in A, expected A<:abstest, got Type{t2{C,B}}

Apparently he is complaining about the definition of field y in the definition of type t2. But t2{C, B} is a subtype of abstest, so {t2{C, B}, B} should be valid parameters for type t1. Probably I am missing something here.

@JeffBezanson JeffBezanson self-assigned this Jan 28, 2016
@JeffBezanson JeffBezanson added the bug Indicates an unexpected problem or unintended behavior label Jan 28, 2016
JeffBezanson added a commit that referenced this issue Jan 29, 2016
a new type's supertype was not taken into account while instantiating
the types of its fields
tkelman pushed a commit to tkelman/julia that referenced this issue Mar 7, 2016
a new type's supertype was not taken into account while instantiating
the types of its fields

(cherry picked from commit 0dd74d5)
ref JuliaLang#14847
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants