Skip to content

Commit a4fe68d

Browse files
committed
fix #3890
1 parent 55ff643 commit a4fe68d

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/interpreter.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ static jl_value_t *eval(jl_value_t *e, jl_value_t **locals, size_t nl)
327327
jl_check_type_tuple(dt->types, dt->name->name, "type definition");
328328
super = eval(args[4], locals, nl);
329329
jl_set_datatype_super(dt, super);
330+
for(size_t i=0; i < jl_tuple_len(para); i++) {
331+
((jl_tvar_t*)jl_tupleref(para,i))->bound = 0;
332+
}
330333
jl_compute_field_offsets(dt);
331334
jl_add_constructors(dt);
332335
JL_GC_POP();

src/julia-syntax.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@
682682
(global ,name)
683683
(const ,name)
684684
,@(map (lambda (v) `(local ,v)) params)
685-
,@(map make-assignment params (symbols->typevars params bounds #f))
685+
,@(map make-assignment params (symbols->typevars params bounds #t))
686686
(composite_type ,name (tuple ,@params)
687687
(tuple ,@(map (lambda (x) `',x) field-names))
688688
(lambda (,name)

test/core.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ type Foo_{T} x::Foo_{Int} end
157157
type Circ_{T} x::Circ_{T} end
158158
@test is(Circ_{Int}, Circ_{Int}.types[1])
159159

160+
# issue #3890
161+
type A3890{T1}
162+
x::Matrix{Complex{T1}}
163+
end
164+
@test A3890{Float64}.types[1] === Array{Complex{Float64},2}
165+
# make sure the field type Matrix{Complex{T1}} isn't cached
166+
type B3890{T2}
167+
x::Matrix{Complex{T2}}
168+
end
169+
@test B3890{Float64}.types[1] === Array{Complex{Float64},2}
170+
160171
# issue #786
161172
type Node{T}
162173
v::Vector{Node}

0 commit comments

Comments
 (0)