Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Jul 7, 2015
2 parents 1c1e168 + eb58c97 commit 9e277ba
Show file tree
Hide file tree
Showing 132 changed files with 2,417 additions and 1,143 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*.dylib
*.dSYM
*.jl.cov
*.jl.*.cov
*.jl.mem
*.ji

Expand Down
10 changes: 8 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,17 @@ There are never enough tests. Track [code coverage at Coveralls](https://coveral

2. Browse through the source files and find some untested functionality (highlighted in red) that you think you might be able to write a test for.

3. Write a test that exercises this functionality---you can add your test to one of the existing files, or start a new one, whichever seems most appropriate to you. If you're adding a new test file, make sure you include it in the list of tests in `test/choosetests.jl`. http:https://julia.readthedocs.org/en/latest/stdlib/test/ may be helpful in explaining how the testing infrastructure works. Submit the test as a pull request (see [CONTRIBUTING.md](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md)).
3. Write a test that exercises this functionality---you can add your test to one of the existing files, or start a new one, whichever seems most appropriate to you. If you're adding a new test file, make sure you include it in the list of tests in `test/choosetests.jl`. http:https://julia.readthedocs.org/en/latest/stdlib/test/ may be helpful in explaining how the testing infrastructure works.

4. Run `make test-all` to rebuild Julia and run your new test(s). If you had to fix a bug or add functionality in `base`, this will ensure that your test passes and that you have not introduced extraneous whitespace.

5. Submit the test as a pull request.

* Code for the buildbot configuration is maintained at: https://github.com/staticfloat/julia-buildbot
* You can see the current buildbot setup at: http:https://buildbot.e.ip.saba.us:8010/builders
* [Issue 9493](https://github.com/JuliaLang/julia/issues/9493) has a more detailed discussion on code coverage.
* [Issue 9493](https://github.com/JuliaLang/julia/issues/9493) and [issue 11885](https://github.com/JuliaLang/julia/issues/11885) have more detailed discussion on code coverage.

Coveralls shows functionality that still needs "proof of concept" tests. These are important, as are tests for tricky edge cases, such as converting between integer types when the number to convert is near the maximum of the range of one of the integer types. Even if a function already has some coverage on Coveralls, it may still benefit from tests for edge cases.

### Improving documentation

Expand Down
5 changes: 0 additions & 5 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,7 @@ endif


# if not absolute, then relative to the directory of the julia executable
# on windows, use .ji by default
ifeq ($(OS),WINNT)
JCPPFLAGS += "-DJL_SYSTEM_IMAGE_PATH=\"$(build_private_libdir_rel)/sys.ji\""
else
JCPPFLAGS += "-DJL_SYSTEM_IMAGE_PATH=\"$(build_private_libdir_rel)/sys.$(SHLIB_EXT)\""
endif

# On Windows, we want shared library files to end up in $(build_bindir), instead of $(build_libdir)
ifeq ($(OS),WINNT)
Expand Down
22 changes: 7 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ else
$(warn "Skipping whitespace check because git is unavailable")
endif

release-candidate: release test
release-candidate: release testall
@$(JULIA_EXECUTABLE) contrib/add_license_to_files.jl #add license headers
@#Check documentation
@$(JULIA_EXECUTABLE) doc/NEWS-update.jl #Add missing cross-references to NEWS.md
@$(MAKE) -C doc unicode #Rebuild Unicode table if necessary
Expand Down Expand Up @@ -182,11 +183,6 @@ $(build_private_libdir)/inference.o: $(build_private_libdir)/inference0.$(SHLIB_
$(call spawn,$(JULIA_EXECUTABLE)) -C $(JULIA_CPU_TARGET) --output-o $(call cygpath_w,$(build_private_libdir)/inference.o) -f \
-J $(call cygpath_w,$(build_private_libdir)/inference0.$(SHLIB_EXT)) coreimg.jl)

# on windows, also generate a .ji file so we can delete the .dll
ifeq ($(OS),WINNT)
JULIA_SYSIMG_BUILD_FLAGS += --output-ji $(call cygpath_w,$(build_private_libdir)/sys.ji)
endif

COMMA:=,
$(build_private_libdir)/sys.o: VERSION $(BASE_SRCS) $(build_docdir)/helpdb.jl $(build_private_libdir)/inference.$(SHLIB_EXT)
@$(call PRINT_JULIA, cd base && \
Expand Down Expand Up @@ -240,6 +236,11 @@ endif
ifeq ($(USE_SYSTEM_SUITESPARSE),0)
JL_PRIVATE_LIBS += amd camd ccolamd cholmod colamd umfpack spqr suitesparseconfig
endif
ifeq ($(USE_SYSTEM_LLVM),0)
ifeq ($(USE_LLVM_SHLIB),1)
JL_PRIVATE_LIBS += LLVM
endif
endif
ifeq ($(OS),Darwin)
ifeq ($(USE_SYSTEM_BLAS),1)
ifeq ($(USE_SYSTEM_LAPACK),0)
Expand Down Expand Up @@ -363,15 +364,9 @@ else ifeq ($(OS), Linux)
endif

# Overwrite JL_SYSTEM_IMAGE_PATH in julia library
ifeq ($(OS),WINNT)
for julia in $(DESTDIR)$(private_libdir)/libjulia*.$(SHLIB_EXT) ; do \
$(call spawn,$(build_bindir)/stringreplace $$(strings -t x - $$julia | grep "sys.ji$$" | awk '{print $$1;}' ) "$(private_libdir_rel)/sys.ji" 256 $(call cygpath_w,$$julia)); \
done
else
for julia in $(DESTDIR)$(private_libdir)/libjulia*.$(SHLIB_EXT) ; do \
$(call spawn,$(build_bindir)/stringreplace $$(strings -t x - $$julia | grep "sys.$(SHLIB_EXT)$$" | awk '{print $$1;}' ) "$(private_libdir_rel)/sys.$(SHLIB_EXT)" 256 $(call cygpath_w,$$julia)); \
done
endif
endif

mkdir -p $(DESTDIR)$(sysconfdir)
Expand Down Expand Up @@ -417,9 +412,6 @@ ifeq ($(JULIA_CPU_TARGET), native)
endif

ifeq ($(OS), WINNT)
# If we are running on windows, also delete sys.dll until we switch to llvm3.5+
-rm -f $(DESTDIR)$(private_libdir)/sys.$(SHLIB_EXT)

[ ! -d dist-extras ] || ( cd dist-extras && \
cp 7z.exe 7z.dll libexpat-1.dll zlib1.dll libgfortran-3.dll libquadmath-0.dll libstdc++-6.dll libgcc_s_s*-1.dll libssp-0.dll $(bindir) && \
mkdir $(DESTDIR)$(prefix)/Git && \
Expand Down
22 changes: 22 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ Language changes
* Triple-quoted strings no longer treat tabs as 8 spaces. Instead, the
longest common prefix of spaces and tabs is removed.

* `global x` in a nested scope is now a syntax error if `x` is local
to the enclosing scope ([#7264]/[#11985]).

Command line option changes
---------------------------

Expand Down Expand Up @@ -340,6 +343,22 @@ Library improvements
Deprecated or removed
---------------------

* several syntax whitespace insensitivities have been deprecated ([#11891]).
```julia
# function call
f (x)

# getindex
x [17]
rand(2) [1]

# function definition
f (x) = x^2
function foo (x)
x^2
end
```

* indexing with Reals that are not subtypes of Integers (Rationals, FloatingPoint, etc.) has been deprecated ([#10458]).

* `push!(A)` has been deprecated, use `append!` instead of splatting arguments to `push!` ([#10400]).
Expand Down Expand Up @@ -1362,6 +1381,7 @@ Too numerous to mention.
[#7234]: https://github.com/JuliaLang/julia/issues/7234
[#7236]: https://github.com/JuliaLang/julia/issues/7236
[#7242]: https://github.com/JuliaLang/julia/issues/7242
[#7264]: https://github.com/JuliaLang/julia/issues/7264
[#7311]: https://github.com/JuliaLang/julia/issues/7311
[#7359]: https://github.com/JuliaLang/julia/issues/7359
[#7365]: https://github.com/JuliaLang/julia/issues/7365
Expand Down Expand Up @@ -1487,4 +1507,6 @@ Too numerous to mention.
[#11379]: https://github.com/JuliaLang/julia/issues/11379
[#11432]: https://github.com/JuliaLang/julia/issues/11432
[#11741]: https://github.com/JuliaLang/julia/issues/11741
[#11891]: https://github.com/JuliaLang/julia/issues/11891
[#11922]: https://github.com/JuliaLang/julia/issues/11922
[#11985]: https://github.com/JuliaLang/julia/issues/11985
68 changes: 44 additions & 24 deletions base/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ type MIState
end
MIState(i, c, a, m) = MIState(i, c, a, m, "", Char[], 0)

function show(io::IO, s::MIState)
print(io, "MI State (", s.current_mode, " active)")
end

type Prompt <: TextInterface
prompt
first_prompt
Expand Down Expand Up @@ -606,7 +610,7 @@ function edit_clear(s::MIState)
end

function replace_line(s::PromptState, l::IOBuffer)
s.input_buffer = l
s.input_buffer = copy(l)
end

function replace_line(s::PromptState, l)
Expand Down Expand Up @@ -1060,6 +1064,12 @@ type PrefixSearchState <: ModeState
new(terminal, histprompt, prefix, response_buffer, InputAreaState(0,0), 0)
end

function show(io::IO, s::PrefixSearchState)
print(io, "PrefixSearchState ", isdefined(s,:parent) ?
string("(", s.parent, " active)") : "(no parent)", " for ",
isdefined(s,:mi) ? s.mi : "no MI")
end

input_string(s::PrefixSearchState) = bytestring(s.response_buffer)

# a meta-prompt that presents itself as parent_prompt, but which has an independent keymap
Expand Down Expand Up @@ -1087,14 +1097,16 @@ function reset_state(s::PrefixSearchState)
end
end

function transition(s::PrefixSearchState, mode)
function transition(f::Function, s::PrefixSearchState, mode)
if isdefined(s,:mi)
transition(s.mi,mode)
transition(f,s.mi,mode)
end
s.parent = mode
s.histprompt.parent_prompt = mode
if isdefined(s,:mi)
transition(s.mi,s.histprompt)
transition(f,s.mi,s.histprompt)
else
f()
end
end

Expand Down Expand Up @@ -1138,8 +1150,9 @@ end

function accept_result(s, p)
parent = state(s, p).parent
replace_line(state(s, parent), state(s, p).response_buffer)
transition(s, parent)
transition(s, parent) do
replace_line(state(s, parent), state(s, p).response_buffer)
end
end

function copybuf!(dst::IOBuffer, src::IOBuffer)
Expand All @@ -1152,28 +1165,33 @@ end

function enter_search(s::MIState, p::HistoryPrompt, backward::Bool)
# a bit of hack to help fix #6325
buf = buffer(s)
buf = copy(buffer(s))
parent = mode(s)
p.hp.last_mode = mode(s)
p.hp.last_buffer = copy(buf)

ss = state(s, p)
ss.parent = mode(s)
ss.backward = backward
truncate(ss.query_buffer, 0)
copybuf!(ss.response_buffer, buf)
transition(s, p)
p.hp.last_buffer = buf

transition(s, p) do
ss = state(s, p)
ss.parent = parent
ss.backward = backward
truncate(ss.query_buffer, 0)
copybuf!(ss.response_buffer, buf)
end
end

function enter_prefix_search(s::MIState, p::PrefixHistoryPrompt, backward::Bool)
buf = buffer(s)

buf = copy(buffer(s))
parent = mode(s)

transition(s, p) do
pss = state(s, p)
pss.parent = parent
pss.prefix = bytestring(pointer(buf.data), position(buf))
copybuf!(pss.response_buffer, buf)
pss.indent = state(s, parent).indent
pss.mi = s
end
pss = state(s, p)
pss.parent = mode(s)
pss.prefix = bytestring(pointer(buf.data), position(buf))
copybuf!(pss.response_buffer, buf)
pss.indent = state(s, mode(s)).indent
pss.mi = s
transition(s, p)
if backward
history_prev_prefix(pss, pss.histprompt.hp, pss.prefix)
else
Expand Down Expand Up @@ -1491,7 +1509,7 @@ function activate(p::TextInterface, s::MIState, termbuf)
end
activate(m::ModalInterface, s::MIState, termbuf) = activate(s.current_mode, s, termbuf)

function transition(s::MIState, mode)
function transition(f::Function, s::MIState, mode)
if mode == :abort
s.aborted = true
return
Expand All @@ -1506,9 +1524,11 @@ function transition(s::MIState, mode)
termbuf = TerminalBuffer(IOBuffer())
s.mode_state[s.current_mode] = deactivate(s.current_mode, s.mode_state[s.current_mode], termbuf)
s.current_mode = mode
f()
activate(mode, s.mode_state[mode], termbuf)
write(terminal(s), takebuf_array(termbuf.out_stream))
end
transition(s::MIState, mode) = transition((args...)->nothing, s, mode)

function reset_state(s::PromptState)
if s.input_buffer.size != 0
Expand Down
37 changes: 20 additions & 17 deletions base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,16 @@ function history_move(s::Union{LineEdit.MIState,LineEdit.PrefixSearchState}, his

# load the saved line
if idx == max_idx
LineEdit.transition(s, hist.last_mode)
LineEdit.replace_line(s, hist.last_buffer)
hist.last_mode = nothing
hist.last_buffer = IOBuffer()
LineEdit.transition(s, hist.last_mode) do
LineEdit.replace_line(s, hist.last_buffer)
hist.last_mode = nothing
hist.last_buffer = IOBuffer()
end
else
if haskey(hist.mode_mapping, hist.modes[idx])
LineEdit.transition(s, hist.mode_mapping[hist.modes[idx]])
LineEdit.replace_line(s, hist.history[idx])
LineEdit.transition(s, hist.mode_mapping[hist.modes[idx]]) do
LineEdit.replace_line(s, hist.history[idx])
end
else
return :skip
end
Expand All @@ -437,8 +439,9 @@ function LineEdit.accept_result(s, p::LineEdit.HistoryPrompt{REPLHistoryProvider
hist = p.hp
if 1 <= hist.cur_idx <= length(hist.modes)
m = hist.mode_mapping[hist.modes[hist.cur_idx]]
LineEdit.transition(s, m)
LineEdit.replace_line(LineEdit.state(s, m), LineEdit.state(s, p).response_buffer)
LineEdit.transition(s, m) do
LineEdit.replace_line(LineEdit.state(s, m), LineEdit.state(s, p).response_buffer)
end
else
LineEdit.transition(s, parent)
end
Expand Down Expand Up @@ -633,9 +636,9 @@ function mode_keymap(julia_prompt)
'\b' => function (s,o...)
if isempty(s) || position(LineEdit.buffer(s)) == 0
buf = copy(LineEdit.buffer(s))
transition(s, julia_prompt)
LineEdit.state(s, julia_prompt).input_buffer = buf
LineEdit.refresh_line(s)
transition(s, julia_prompt) do
LineEdit.state(s, julia_prompt).input_buffer = buf
end
else
LineEdit.edit_backspace(s)
end
Expand Down Expand Up @@ -759,19 +762,19 @@ function setup_interface(repl::LineEditREPL; hascolor = repl.hascolor, extra_rep
';' => function (s,o...)
if isempty(s) || position(LineEdit.buffer(s)) == 0
buf = copy(LineEdit.buffer(s))
transition(s, shell_mode)
LineEdit.state(s, shell_mode).input_buffer = buf
LineEdit.refresh_line(s)
transition(s, shell_mode) do
LineEdit.state(s, shell_mode).input_buffer = buf
end
else
edit_insert(s, ';')
end
end,
'?' => function (s,o...)
if isempty(s) || position(LineEdit.buffer(s)) == 0
buf = copy(LineEdit.buffer(s))
transition(s, help_mode)
LineEdit.state(s, help_mode).input_buffer = buf
LineEdit.refresh_line(s)
transition(s, help_mode) do
LineEdit.state(s, help_mode).input_buffer = buf
end
else
edit_insert(s, '?')
end
Expand Down
6 changes: 3 additions & 3 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ end

# default arguments to similar()
similar{T}(a::AbstractArray{T}) = similar(a, T, size(a))
similar (a::AbstractArray, T) = similar(a, T, size(a))
similar( a::AbstractArray, T) = similar(a, T, size(a))
similar{T}(a::AbstractArray{T}, dims::Dims) = similar(a, T, dims)
similar{T}(a::AbstractArray{T}, dims::Int...) = similar(a, T, dims)
similar (a::AbstractArray, T, dims::Int...) = similar(a, T, dims)
similar( a::AbstractArray, T, dims::Int...) = similar(a, T, dims)
# similar creates an Array by default
similar (a::AbstractArray, T, dims::Dims) = Array(T, dims)
similar( a::AbstractArray, T, dims::Dims) = Array(T, dims)

function reshape(a::AbstractArray, dims::Dims)
if prod(dims) != length(a)
Expand Down
2 changes: 2 additions & 0 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ BitArray(dims::Int...) = BitArray(dims)
typealias BitVector BitArray{1}
typealias BitMatrix BitArray{2}

call(::Type{BitVector}) = BitArray{1}(0)

## utility functions ##

length(B::BitArray) = B.len
Expand Down
Loading

0 comments on commit 9e277ba

Please sign in to comment.