Skip to content

Commit 8d9adb0

Browse files
authored
1 parent 5f6fb30 commit 8d9adb0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/optimize.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,10 @@ function parametric_type_to_expr(@nospecialize(t::Type))
255255
if Base.isvarargtype(t)
256256
return Expr(:(...), t.parameters[1])
257257
end
258-
if t.hasfreetypevars
258+
if Base.has_free_typevars(t)
259259
params = map(t.parameters) do @nospecialize(p)
260260
isa(p, TypeVar) ? p.name :
261-
isa(p, DataType) && p.hasfreetypevars ? parametric_type_to_expr(p) : p
261+
isa(p, DataType) && Base.has_free_typevars(p) ? parametric_type_to_expr(p) : p
262262
end
263263
return Expr(:curly, scopename(t.name), params...)::Expr
264264
end

test/interpret.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,3 +791,16 @@ end
791791
end
792792
@test @interpret(f()) === 3
793793
end
794+
795+
@testset "https://github.com/JuliaLang/julia/pull/41018" begin
796+
m = Module()
797+
@eval m begin
798+
struct Foo
799+
foo::Int
800+
bar
801+
end
802+
end
803+
# this shouldn't throw "type DataType has no field hasfreetypevars"
804+
# even after https://github.com/JuliaLang/julia/pull/41018
805+
@test Int === @interpret Core.Compiler.getfield_tfunc(m.Foo, Core.Compiler.Const(:foo))
806+
end

0 commit comments

Comments
 (0)