Skip to content

Commit 5b8423a

Browse files
authored
update to incoming changes in Core.Compiler (#239)
After <JuliaLang/julia#42583> is merged, `widenconst` doesn't accept non-valid Julia types (i.e. `TypeVar`/`Vararg`), and we will handle them explicitly.
1 parent af1a2fc commit 5b8423a

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/Cthulhu.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ using REPL: REPL, AbstractTerminal
1010
using Core: MethodInstance
1111
const Compiler = Core.Compiler
1212
using Core.Compiler: MethodMatch, LimitedAccuracy, ignorelimited
13-
13+
import Base: unwrapva, isvarargtype
1414
const mapany = Base.mapany
1515

1616
# branch on https://github.com/JuliaLang/julia/pull/42125

src/callsite.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,23 @@ function Base.take!(io::TextWidthLimiter)
176176
end
177177

178178
function headstring(@nospecialize(T))
179-
T = widenconst(Base.unwrapva(T))
179+
if isvarargtype(T)
180+
T = unwrapva(T)
181+
elseif isa(T, TypeVar)
182+
return string(T.name)
183+
end
184+
T = widenconst(T)
180185
if T isa Union || T === Union{}
181186
return string(T)::String
182187
elseif T isa UnionAll
183188
return headstring(Base.unwrap_unionall(T))
184-
elseif T isa TypeVar
185-
return string(T.name)
186189
else
187190
return string(T.name.name)::String
188191
end
189192
end
190193

191-
192194
function __show_limited(limiter, name, tt, @nospecialize(rt))
193-
vastring(@nospecialize(T)) = (Base.isvarargtype(T) ? headstring(T)*"..." : string(T)::String)
195+
vastring(@nospecialize(T)) = (isvarargtype(T) ? headstring(T)*"..." : string(T)::String)
194196

195197
if !has_space(limiter, name)
196198
print(limiter, '')

src/reflection.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
##
44

55
using Base.Meta
6-
using .Compiler: widenconst, argextype, Const, MethodMatchInfo,
6+
import .Compiler: widenconst, argextype, Const, MethodMatchInfo,
77
UnionSplitApplyCallInfo, UnionSplitInfo, ConstCallInfo,
88
MethodResultPure, ApplyCallInfo
99

0 commit comments

Comments
 (0)