Skip to content

Commit c82e383

Browse files
authored
Merge branch 'master' into os/more-memoryrefnew
2 parents e1f2398 + f855e4c commit c82e383

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+622
-169
lines changed

AGENTS.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,23 @@ The test system supports doing this automatically (see below).
3838

3939
### Doctests
4040

41-
If you have changed doctests (i.e. any `jldoctest` code block), you should run the doctests before
42-
preparing a PR. See `doc/README.md` for how to do this. For instructions on writing doctests, see
43-
`doc/src/devdocs/contributing/jldoctests.md`. Note that the doctests may take up to 15 minutes.
44-
Do not terminate the doctests before completion. If you are ChatGPT, you may have to increase yield_timeout_ms.
41+
#### Writing doctests
42+
43+
If you are asked to write new doctests, first review `doc/src/devdocs/contributing/jldoctests.md`
44+
for best practices.
45+
46+
#### Verifying doctests
47+
If you have changed any `jldoctest` code blocks you should take
48+
the following steps to verify your work:
49+
- Review `doc/src/devdocs/contributing/jldoctests.md`. In particular, determine
50+
if any of the changed doctests require filters, labels or setup code.
51+
- Run the doctests to verify that your change works:
52+
- To run doctest with the pre-built juliaup: `make -C doc doctest=true revise=true JULIA_EXECUTABLE=$HOME/.juliaup/bin/julia`
53+
- To run doctest with in-trr julia (preferred): `make -C doc doctest=true revise=true`. Do not pass any other options.
54+
- IMPORTANT: The doctests may take up to 15 minutes. Do NOT terminate the doctests before completion. Do NOT use a timeout for doctests.
55+
- If you are ChatGPT, you may have to increase yield_timeout_ms.
56+
57+
Follow these steps for EVERY change you make in a doctest.
4558

4659
### Test changes
4760

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ A useful bug report filed as a GitHub issue provides information about how to re
5454

5555
* Review discussions on the [Julia Discourse forum](https://discourse.julialang.org).
5656

57+
* If your pull request contains substantial contributions from a generative AI tool, please disclose so with details, and review all changes before opening.
58+
5759
* Relax and have fun!
5860

5961
### Guidance for specific changes

Compiler/src/ssair/slot2ssa.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ end
88
SlotInfo() = SlotInfo(Int[], Int[], false)
99

1010
function scan_entry!(result::Vector{SlotInfo}, idx::Int, @nospecialize(stmt))
11-
# NewVarNodes count as defs for the purpose
11+
# NewvarNodes count as defs for the purpose
1212
# of liveness analysis (i.e. they kill use chains)
1313
if isa(stmt, NewvarNode)
1414
result[slot_id(stmt.slot)].any_newvar = true

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ New language features
55
---------------------
66

77
- New `Base.@acquire` macro for a non-closure version of `Base.acquire(f, s::Base.Semaphore)`, like `@lock`. ([#56845])
8+
- New `nth` function to access the `n`-th element of a generic iterable. ([#56580])
89
- The character U+1F8B2 🢲 (RIGHTWARDS ARROW WITH LOWER HOOK), newly added by Unicode 16,
910
is now a valid operator with arrow precedence, accessible as `\hookunderrightarrow` at the REPL.
1011
([JuliaLang/JuliaSyntax.jl#525], [#57143])

base/abstractarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ julia> similar(1:10, 1, 4)
796796
Conversely, `similar(trues(10,10), 2)` returns an uninitialized `BitVector` with two
797797
elements since `BitArray`s are both mutable and can support 1-dimensional arrays:
798798
799-
```julia-repl
799+
```jldoctest; filter = r"[01]"
800800
julia> similar(trues(10,10), 2)
801801
2-element BitVector:
802802
0

base/array.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ end
904904

905905
## Iteration ##
906906

907-
iterate(A::Array, i=1) = (@inline; (i - 1)%UInt < length(A)%UInt ? (@inbounds A[i], i + 1) : nothing)
907+
iterate(A::Array, i=1) = (@inline; _iterate_array(A, i))
908908

909909
## Indexing: getindex ##
910910

base/bitarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Construct an undef [`BitArray`](@ref) with the given dimensions.
5353
Behaves identically to the [`Array`](@ref) constructor. See [`undef`](@ref).
5454
5555
# Examples
56-
```julia-repl
56+
```jldoctest; filter = r"[01]"
5757
julia> BitArray(undef, 2, 2)
5858
2×2 BitMatrix:
5959
0 0

base/boot.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ const undef = UndefInitializer()
590590
# empty vector constructor
591591
(self::Type{GenericMemory{kind,T,addrspace}})() where {T,kind,addrspace} = self(undef, 0)
592592

593+
# memoryref is simply convenience wrapper function around memoryrefnew
593594
memoryref(mem::GenericMemory) = memoryrefnew(mem)
594595
memoryref(mem::GenericMemory, i::Integer) = memoryrefnew(mem, Int(i), @_boundscheck)
595596
memoryref(ref::GenericMemoryRef, i::Integer) = memoryrefnew(ref, Int(i), @_boundscheck)
@@ -744,17 +745,19 @@ let
744745
end
745746

746747
# module providing the IR object model
748+
# excluding types already exported by Core (GlobalRef, QuoteNode, Expr, LineNumberNode)
749+
# any type beyond these is self-quoting (see also Base.is_ast_node)
747750
module IR
748751

749752
export CodeInfo, MethodInstance, CodeInstance, GotoNode, GotoIfNot, ReturnNode,
750753
NewvarNode, SSAValue, SlotNumber, Argument,
751754
PiNode, PhiNode, PhiCNode, UpsilonNode, DebugInfo,
752-
Const, PartialStruct, InterConditional, EnterNode, memoryref
755+
Const, PartialStruct, InterConditional, EnterNode
753756

754757
using Core: CodeInfo, MethodInstance, CodeInstance, GotoNode, GotoIfNot, ReturnNode,
755758
NewvarNode, SSAValue, SlotNumber, Argument,
756759
PiNode, PhiNode, PhiCNode, UpsilonNode, DebugInfo,
757-
Const, PartialStruct, InterConditional, EnterNode, memoryref
760+
Const, PartialStruct, InterConditional, EnterNode
758761

759762
end # module IR
760763

base/errorshow.jl

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,33 @@ function showerror(io::IO, ex::MethodError)
327327
if ft <: AbstractArray
328328
print(io, "\nIn case you're trying to index into the array, use square brackets [] instead of parentheses ().")
329329
end
330-
# Check for local functions that shadow methods in Base
331-
let name = ft.name.singletonname
332-
if f_is_function && isdefined(Base, name)
333-
basef = getfield(Base, name)
334-
if basef !== f && hasmethod(basef, arg_types)
335-
print(io, "\nYou may have intended to import ")
336-
show_unquoted(io, Expr(:., :Base, QuoteNode(name)))
330+
# Check for functions with the same name in other modules
331+
if f_is_function && ex.world != typemax(UInt)
332+
let name = ft.name.singletonname
333+
modules_to_check = Set{Module}()
334+
push!(modules_to_check, Base)
335+
for T in san_arg_types_param
336+
modulesof!(modules_to_check, T)
337+
end
338+
339+
# Check all modules (sorted for consistency)
340+
sorted_modules = sort!(collect(modules_to_check), by=nameof)
341+
for mod in sorted_modules
342+
if isdefined(mod, name)
343+
candidate = getfield(mod, name)
344+
if candidate !== f && hasmethod(candidate, arg_types; world=ex.world)
345+
if mod === Base
346+
print(io, "\nYou may have intended to import ")
347+
show_unquoted(io, Expr(:., :Base, QuoteNode(name)))
348+
else
349+
print(io, "\nThe definition in ")
350+
show_unquoted(io, mod)
351+
print(io, " may have intended to extend ")
352+
f_module = parentmodule(ft)
353+
show_unquoted(io, Expr(:., f_module, QuoteNode(name)))
354+
end
355+
end
356+
end
337357
end
338358
end
339359
end

base/essentials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3-
using Core: CodeInfo, SimpleVector, donotdelete, compilerbarrier, memoryrefnew, memoryrefget, memoryrefset!
3+
using Core: CodeInfo, SimpleVector, donotdelete, compilerbarrier, memoryref, memoryrefnew, memoryrefget, memoryrefset!
44

55
const Callable = Union{Function,Type}
66

0 commit comments

Comments
 (0)