Skip to content

Commit 3c7e88b

Browse files
vtjnashaviatesk
authored andcommitted
[Compiler] fix stdout/stderr to point to Core (#59672)
Followup to #58425 Fixes #56645
1 parent 8e5455f commit 3c7e88b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Compiler/src/Compiler.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ using Core: ABIOverride, Builtin, CodeInstance, IntrinsicFunction, MethodInstanc
4141
MethodTable, MethodCache, PartialOpaque, SimpleVector, TypeofVararg,
4242
_apply_iterate, apply_type, compilerbarrier, donotdelete, memoryref_isassigned,
4343
memoryrefget, memoryrefnew, memoryrefoffset, memoryrefset!, print, println, show, svec,
44-
typename, unsafe_write, write
44+
typename, unsafe_write, write, stdout, stderr
4545

46-
using Base
4746
using Base: @_foldable_meta, @_gc_preserve_begin, @_gc_preserve_end, @nospecializeinfer,
4847
PARTITION_KIND_GLOBAL, PARTITION_KIND_UNDEF_CONST, PARTITION_KIND_BACKDATED_CONST, PARTITION_KIND_DECLARED,
4948
PARTITION_FLAG_DEPWARN,
@@ -64,7 +63,10 @@ using Base: @_foldable_meta, @_gc_preserve_begin, @_gc_preserve_end, @nospeciali
6463
partition_restriction, quoted, rename_unionall, rewrap_unionall, specialize_method,
6564
structdiff, tls_world_age, unconstrain_vararg_length, unionlen, uniontype_layout,
6665
uniontypes, unsafe_convert, unwrap_unionall, unwrapva, vect, widen_diagonal,
67-
_uncompressed_ir, maybe_add_binding_backedge!
66+
_uncompressed_ir, maybe_add_binding_backedge!,
67+
devnull, devnull as stdin
68+
69+
using Base
6870
using Base.Order
6971

7072
import Base: ==, _topmod, append!, convert, copy, copy!, findall, first, get, get!,

Compiler/test/validation.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ using Test, Core.IR
44

55
include("setup_Compiler.jl")
66

7+
@testset "stdio validation" begin
8+
for s in (:stdout, :stderr, :print, :println, :write)
9+
@test getglobal(Compiler, s) === getglobal(Core, s)
10+
@test isconst(Compiler, s)
11+
end
12+
@test Compiler.stdin === devnull
13+
@test isconst(Compiler, :stdin)
14+
end
15+
716
function f22938(a, b, x...)
817
nothing
918
nothing

0 commit comments

Comments
 (0)