From d0dfbd939fe12f5ded1d7160752abea27f630594 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Mon, 18 Jul 2016 20:21:02 -0700 Subject: [PATCH 01/10] Revert "temporarily distclean libgit2 and deps on travis" (#17485) This reverts commit 854d905b1f7a939c540555a5d019fdd40dd7f028. [av skip] --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d5f64bf36e2bd..94edf04dbd460 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,7 +95,6 @@ before_install: script: - make -C moreutils mispipe - make $BUILDOPTS -C base version_git.jl.phony - - make $BUILDOPTS NO_GIT=1 -C deps distclean-libgit2 distclean-libssh2 distclean-mbedtls - moreutils/mispipe "make $BUILDOPTS NO_GIT=1 -C deps" bar > deps.log || cat deps.log - make $BUILDOPTS NO_GIT=1 prefix=/tmp/julia install | moreutils/ts -s "%.s" - make $BUILDOPTS NO_GIT=1 build-stats From dc14f2e765649d94061ed5bee25a3e85b7c5d1c5 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 18 Jul 2016 23:21:55 -0400 Subject: [PATCH 02/10] Return to previous strategy for @ inferred without kwargs (#17482) While the new code worked, it slowed things down too much. --- base/test.jl | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/base/test.jl b/base/test.jl index 13a3566c1e9b3..743e0ce736708 100644 --- a/base/test.jl +++ b/base/test.jl @@ -914,20 +914,24 @@ julia> @inferred max(1,2) """ macro inferred(ex) Meta.isexpr(ex, :call)|| error("@inferred requires a call expression") - args = gensym() - kwargs = gensym() - - # Need to only construct a call with a kwargs if there are actually kwargs, since - # the inferred type depends on the presence/absence of kwargs - if any(a->(Meta.isexpr(a, :kw) || Meta.isexpr(a, :parameters)), ex.args) - typecall = :($(ex.args[1])($(args)...; $(kwargs)...)) - else - typecall = :($(ex.args[1])($(args)...)) - end Base.remove_linenums!(quote - $(esc(args)), $(esc(kwargs)), result = $(esc(Expr(:call, _args_and_call, ex.args[2:end]..., ex.args[1]))) - inftypes = $(Base.gen_call_with_extracted_types(Base.return_types, typecall)) + $(if any(a->(Meta.isexpr(a, :kw) || Meta.isexpr(a, :parameters)), ex.args) + # Has keywords + args = gensym() + kwargs = gensym() + quote + $(esc(args)), $(esc(kwargs)), result = $(esc(Expr(:call, _args_and_call, ex.args[2:end]..., ex.args[1]))) + inftypes = $(Base.gen_call_with_extracted_types(Base.return_types, :($(ex.args[1])($(args)...; $(kwargs)...)))) + end + else + # No keywords + quote + args = ($([esc(ex.args[i]) for i = 2:length(ex.args)]...),) + result = $(esc(ex.args[1]))(args...) + inftypes = Base.return_types($(esc(ex.args[1])), Base.typesof(args...)) + end + end) @assert length(inftypes) == 1 rettype = isa(result, Type) ? Type{result} : typeof(result) rettype == inftypes[1] || error("return type $rettype does not match inferred return type $(inftypes[1])") From 93ee8dd2e2eccb79871133f980b9cebc9166b260 Mon Sep 17 00:00:00 2001 From: Felipe Noronha Date: Tue, 19 Jul 2016 03:48:38 -0300 Subject: [PATCH 03/10] docs: remove direct calls to require (#17277) --- doc/manual/parallel-computing.rst | 2 +- doc/manual/workflow-tips.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/manual/parallel-computing.rst b/doc/manual/parallel-computing.rst index 10270911bcd5a..f36682002a570 100644 --- a/doc/manual/parallel-computing.rst +++ b/doc/manual/parallel-computing.rst @@ -282,7 +282,7 @@ The function ``count_heads`` simply adds together ``n`` random bits. Here is how we can perform some trials on two machines, and add together the results:: - require("count_heads") + @everywhere include("count_heads.jl") a = @spawn count_heads(100000000) b = @spawn count_heads(100000000) diff --git a/doc/manual/workflow-tips.rst b/doc/manual/workflow-tips.rst index 874d6a5daae79..6eef93d22bc93 100644 --- a/doc/manual/workflow-tips.rst +++ b/doc/manual/workflow-tips.rst @@ -75,7 +75,7 @@ issuing the command:: If you further add the following to your ``.juliarc.jl`` file :: - isinteractive() && isfile("_init.jl") && require("_init.jl") + isfile("_init.jl") && include(joinpath(pwd(), "_init.jl")) then calling ``julia`` from that directory will run the initialization code without the additional command line argument. From c7ca319509199ed4c3746a18f7d211487a8c95dc Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Tue, 19 Jul 2016 12:45:10 +0000 Subject: [PATCH 04/10] Don't introduce spurious libLLVM dependency into julia binary (#17486) * Don't introduce spurious libLLVM dependency into julia binary This causes problems with the new RPATH handling since we now omit lib/julia from the executable's RPATH. Fix this by not forcing the executable to link against libLLVM, since we don't require it. Fixes #17484. * Provide link-time rpath Unlike ld.so, ld does not understand `$ORIGIN`, so provide the full path to it at link time to make sure it can find the appropriate dependencies. --- Make.inc | 2 +- ui/Makefile | 16 +--------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/Make.inc b/Make.inc index c8d5beaa09532..5824bd73efa64 100644 --- a/Make.inc +++ b/Make.inc @@ -846,7 +846,7 @@ else ifeq ($(OS), Darwin) RPATH_ORIGIN := -Wl,-rpath,'@loader_path/' RPATH_LIB := -Wl,-rpath,'@loader_path/' -Wl,-rpath,'@loader_path/julia/' else - RPATH := -Wl,-rpath,'$$ORIGIN/$(build_libdir_rel)' -Wl,-z,origin + RPATH := -Wl,-rpath,'$$ORIGIN/$(build_libdir_rel)' -Wl,-rpath-link,$(build_shlibdir) -Wl,-z,origin RPATH_ORIGIN := -Wl,-rpath,'$$ORIGIN' -Wl,-z,origin RPATH_LIB := -Wl,-rpath,'$$ORIGIN' -Wl,-rpath,'$$ORIGIN/julia' -Wl,-z,origin endif diff --git a/ui/Makefile b/ui/Makefile index f869b429824e0..49c4dbac40167 100644 --- a/ui/Makefile +++ b/ui/Makefile @@ -23,21 +23,7 @@ OBJS := $(SRCS:%=$(BUILDDIR)/%.o) DOBJS := $(SRCS:%=$(BUILDDIR)/%.dbg.obj) DEBUGFLAGS += $(FLAGS) SHIPFLAGS += $(FLAGS) - -ifeq ($(USE_LLVM_SHLIB),1) -ifeq ($(LLVM_USE_CMAKE),1) -LLVMLINK := $(shell $(LLVM_CONFIG_HOST) --ldflags) -lLLVM -else -ifeq ($(OS),WINNT) -LLVMLINK := $(shell $(LLVM_CONFIG_HOST) --ldflags) -lLLVM-$(LLVM_VER_SHORT) -else -LLVMLINK := $(shell $(LLVM_CONFIG_HOST) --ldflags) -lLLVM-$(shell $(LLVM_CONFIG_HOST) --version) -endif # OS == WINNT -endif # LLVM_USE_CMAKE == 1 -else -LLVMLINK := -endif # USE_LLVM_SHLIB == 1 -JLDFLAGS += $(LDFLAGS) $(NO_WHOLE_ARCHIVE) $(OSLIBS) $(LLVMLINK) $(RPATH) +JLDFLAGS += $(LDFLAGS) $(NO_WHOLE_ARCHIVE) $(OSLIBS) $(RPATH) ifeq ($(USE_SYSTEM_LIBM),0) ifneq ($(UNTRUSTED_SYSTEM_LIBM),0) From b901a44fea645d40e592e0d3172375e41d1bbdb7 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Tue, 12 Jul 2016 19:56:54 -0400 Subject: [PATCH 05/10] parse more dot operators for #16285, parse .= with assignment precedence --- src/julia-parser.scm | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/julia-parser.scm b/src/julia-parser.scm index bc4c96c98e7c9..6e445d0cca56f 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -1,23 +1,31 @@ ;; Operator precedence table, lowest at top +; for most operators X there is a .X "elementwise" equivalent +(define (add-dots ops) (append! ops (map (lambda (op) (symbol (string "." op))) ops))) + ;; note: there are some strange-looking things in here because ;; the way the lexer works, every prefix of an operator must also ;; be an operator. (define prec-assignment - '(= := += -= *= /= //= .//= .*= ./= |\\=| |.\\=| ^= .^= ÷= .÷= %= .%= |\|=| &= $= => <<= >>= >>>= ~ |.+=| |.-=|)) + (append! (add-dots '(= += -= *= /= //= |\\=| ^= ÷= %= <<= >>= >>>= |\|=| &=)) + '(:= => ~ $=))) (define prec-conditional '(?)) -(define prec-arrow '(-- --> ← → ↔ ↚ ↛ ↠ ↣ ↦ ↮ ⇎ ⇏ ⇒ ⇔ ⇴ ⇶ ⇷ ⇸ ⇹ ⇺ ⇻ ⇼ ⇽ ⇾ ⇿ ⟵ ⟶ ⟷ ⟷ ⟹ ⟺ ⟻ ⟼ ⟽ ⟾ ⟿ ⤀ ⤁ ⤂ ⤃ ⤄ ⤅ ⤆ ⤇ ⤌ ⤍ ⤎ ⤏ ⤐ ⤑ ⤔ ⤕ ⤖ ⤗ ⤘ ⤝ ⤞ ⤟ ⤠ ⥄ ⥅ ⥆ ⥇ ⥈ ⥊ ⥋ ⥎ ⥐ ⥒ ⥓ ⥖ ⥗ ⥚ ⥛ ⥞ ⥟ ⥢ ⥤ ⥦ ⥧ ⥨ ⥩ ⥪ ⥫ ⥬ ⥭ ⥰ ⧴ ⬱ ⬰ ⬲ ⬳ ⬴ ⬵ ⬶ ⬷ ⬸ ⬹ ⬺ ⬻ ⬼ ⬽ ⬾ ⬿ ⭀ ⭁ ⭂ ⭃ ⭄ ⭇ ⭈ ⭉ ⭊ ⭋ ⭌ ← →)) +(define prec-arrow (append! + '(-- -->) + (add-dots '(← → ↔ ↚ ↛ ↠ ↣ ↦ ↮ ⇎ ⇏ ⇒ ⇔ ⇴ ⇶ ⇷ ⇸ ⇹ ⇺ ⇻ ⇼ ⇽ ⇾ ⇿ ⟵ ⟶ ⟷ ⟷ ⟹ ⟺ ⟻ ⟼ ⟽ ⟾ ⟿ ⤀ ⤁ ⤂ ⤃ ⤄ ⤅ ⤆ ⤇ ⤌ ⤍ ⤎ ⤏ ⤐ ⤑ ⤔ ⤕ ⤖ ⤗ ⤘ ⤝ ⤞ ⤟ ⤠ ⥄ ⥅ ⥆ ⥇ ⥈ ⥊ ⥋ ⥎ ⥐ ⥒ ⥓ ⥖ ⥗ ⥚ ⥛ ⥞ ⥟ ⥢ ⥤ ⥦ ⥧ ⥨ ⥩ ⥪ ⥫ ⥬ ⥭ ⥰ ⧴ ⬱ ⬰ ⬲ ⬳ ⬴ ⬵ ⬶ ⬷ ⬸ ⬹ ⬺ ⬻ ⬼ ⬽ ⬾ ⬿ ⭀ ⭁ ⭂ ⭃ ⭄ ⭇ ⭈ ⭉ ⭊ ⭋ ⭌ ← →)))) (define prec-lazy-or '(|\|\||)) (define prec-lazy-and '(&&)) (define prec-comparison - '(> < >= ≥ <= ≤ == === ≡ != ≠ !== ≢ |.>| |.<| |.>=| |.≥| |.<=| |.≤| |.==| |.!=| |.≠| |.=| |.!| |<:| |>:| ∈ ∉ ∋ ∌ ⊆ ⊈ ⊂ ⊄ ⊊ ∝ ∊ ∍ ∥ ∦ ∷ ∺ ∻ ∽ ∾ ≁ ≃ ≄ ≅ ≆ ≇ ≈ ≉ ≊ ≋ ≌ ≍ ≎ ≐ ≑ ≒ ≓ ≔ ≕ ≖ ≗ ≘ ≙ ≚ ≛ ≜ ≝ ≞ ≟ ≣ ≦ ≧ ≨ ≩ ≪ ≫ ≬ ≭ ≮ ≯ ≰ ≱ ≲ ≳ ≴ ≵ ≶ ≷ ≸ ≹ ≺ ≻ ≼ ≽ ≾ ≿ ⊀ ⊁ ⊃ ⊅ ⊇ ⊉ ⊋ ⊏ ⊐ ⊑ ⊒ ⊜ ⊩ ⊬ ⊮ ⊰ ⊱ ⊲ ⊳ ⊴ ⊵ ⊶ ⊷ ⋍ ⋐ ⋑ ⋕ ⋖ ⋗ ⋘ ⋙ ⋚ ⋛ ⋜ ⋝ ⋞ ⋟ ⋠ ⋡ ⋢ ⋣ ⋤ ⋥ ⋦ ⋧ ⋨ ⋩ ⋪ ⋫ ⋬ ⋭ ⋲ ⋳ ⋴ ⋵ ⋶ ⋷ ⋸ ⋹ ⋺ ⋻ ⋼ ⋽ ⋾ ⋿ ⟈ ⟉ ⟒ ⦷ ⧀ ⧁ ⧡ ⧣ ⧤ ⧥ ⩦ ⩧ ⩪ ⩫ ⩬ ⩭ ⩮ ⩯ ⩰ ⩱ ⩲ ⩳ ⩴ ⩵ ⩶ ⩷ ⩸ ⩹ ⩺ ⩻ ⩼ ⩽ ⩾ ⩿ ⪀ ⪁ ⪂ ⪃ ⪄ ⪅ ⪆ ⪇ ⪈ ⪉ ⪊ ⪋ ⪌ ⪍ ⪎ ⪏ ⪐ ⪑ ⪒ ⪓ ⪔ ⪕ ⪖ ⪗ ⪘ ⪙ ⪚ ⪛ ⪜ ⪝ ⪞ ⪟ ⪠ ⪡ ⪢ ⪣ ⪤ ⪥ ⪦ ⪧ ⪨ ⪩ ⪪ ⪫ ⪬ ⪭ ⪮ ⪯ ⪰ ⪱ ⪲ ⪳ ⪴ ⪵ ⪶ ⪷ ⪸ ⪹ ⪺ ⪻ ⪼ ⪽ ⪾ ⪿ ⫀ ⫁ ⫂ ⫃ ⫄ ⫅ ⫆ ⫇ ⫈ ⫉ ⫊ ⫋ ⫌ ⫍ ⫎ ⫏ ⫐ ⫑ ⫒ ⫓ ⫔ ⫕ ⫖ ⫗ ⫘ ⫙ ⫷ ⫸ ⫹ ⫺ ⊢ ⊣)) ;; plus `in` + (append! '(|<:| |>:| |.!|) + (add-dots '(> < >= ≥ <= ≤ == === ≡ != ≠ !== ≢ ∈ ∉ ∋ ∌ ⊆ ⊈ ⊂ ⊄ ⊊ ∝ ∊ ∍ ∥ ∦ ∷ ∺ ∻ ∽ ∾ ≁ ≃ ≄ ≅ ≆ ≇ ≈ ≉ ≊ ≋ ≌ ≍ ≎ ≐ ≑ ≒ ≓ ≔ ≕ ≖ ≗ ≘ ≙ ≚ ≛ ≜ ≝ ≞ ≟ ≣ ≦ ≧ ≨ ≩ ≪ ≫ ≬ ≭ ≮ ≯ ≰ ≱ ≲ ≳ ≴ ≵ ≶ ≷ ≸ ≹ ≺ ≻ ≼ ≽ ≾ ≿ ⊀ ⊁ ⊃ ⊅ ⊇ ⊉ ⊋ ⊏ ⊐ ⊑ ⊒ ⊜ ⊩ ⊬ ⊮ ⊰ ⊱ ⊲ ⊳ ⊴ ⊵ ⊶ ⊷ ⋍ ⋐ ⋑ ⋕ ⋖ ⋗ ⋘ ⋙ ⋚ ⋛ ⋜ ⋝ ⋞ ⋟ ⋠ ⋡ ⋢ ⋣ ⋤ ⋥ ⋦ ⋧ ⋨ ⋩ ⋪ ⋫ ⋬ ⋭ ⋲ ⋳ ⋴ ⋵ ⋶ ⋷ ⋸ ⋹ ⋺ ⋻ ⋼ ⋽ ⋾ ⋿ ⟈ ⟉ ⟒ ⦷ ⧀ ⧁ ⧡ ⧣ ⧤ ⧥ ⩦ ⩧ ⩪ ⩫ ⩬ ⩭ ⩮ ⩯ ⩰ ⩱ ⩲ ⩳ ⩴ ⩵ ⩶ ⩷ ⩸ ⩹ ⩺ ⩻ ⩼ ⩽ ⩾ ⩿ ⪀ ⪁ ⪂ ⪃ ⪄ ⪅ ⪆ ⪇ ⪈ ⪉ ⪊ ⪋ ⪌ ⪍ ⪎ ⪏ ⪐ ⪑ ⪒ ⪓ ⪔ ⪕ ⪖ ⪗ ⪘ ⪙ ⪚ ⪛ ⪜ ⪝ ⪞ ⪟ ⪠ ⪡ ⪢ ⪣ ⪤ ⪥ ⪦ ⪧ ⪨ ⪩ ⪪ ⪫ ⪬ ⪭ ⪮ ⪯ ⪰ ⪱ ⪲ ⪳ ⪴ ⪵ ⪶ ⪷ ⪸ ⪹ ⪺ ⪻ ⪼ ⪽ ⪾ ⪿ ⫀ ⫁ ⫂ ⫃ ⫄ ⫅ ⫆ ⫇ ⫈ ⫉ ⫊ ⫋ ⫌ ⫍ ⫎ ⫏ ⫐ ⫑ ⫒ ⫓ ⫔ ⫕ ⫖ ⫗ ⫘ ⫙ ⫷ ⫸ ⫹ ⫺ ⊢ ⊣)))) ;; (plus `in`) (define prec-pipe '(|\|>| |<\||)) (define prec-colon '(: |..|)) -(define prec-plus '(+ - ⊕ ⊖ ⊞ ⊟ |.+| |.-| |++| |\|| ∪ ∨ $ ⊔ ± ∓ ∔ ∸ ≂ ≏ ⊎ ⊻ ⊽ ⋎ ⋓ ⧺ ⧻ ⨈ ⨢ ⨣ ⨤ ⨥ ⨦ ⨧ ⨨ ⨩ ⨪ ⨫ ⨬ ⨭ ⨮ ⨹ ⨺ ⩁ ⩂ ⩅ ⩊ ⩌ ⩏ ⩐ ⩒ ⩔ ⩖ ⩗ ⩛ ⩝ ⩡ ⩢ ⩣)) -(define prec-bitshift '(<< >> >>> |.<<| |.>>| |.>>>|)) -(define prec-times '(* / |./| ÷ |.÷| % ⋅ ∘ × |.%| |.*| |\\| |.\\| & ∩ ∧ ⊗ ⊘ ⊙ ⊚ ⊛ ⊠ ⊡ ⊓ ∗ ∙ ∤ ⅋ ≀ ⊼ ⋄ ⋆ ⋇ ⋉ ⋊ ⋋ ⋌ ⋏ ⋒ ⟑ ⦸ ⦼ ⦾ ⦿ ⧶ ⧷ ⨇ ⨰ ⨱ ⨲ ⨳ ⨴ ⨵ ⨶ ⨷ ⨸ ⨻ ⨼ ⨽ ⩀ ⩃ ⩄ ⩋ ⩍ ⩎ ⩑ ⩓ ⩕ ⩘ ⩚ ⩜ ⩞ ⩟ ⩠ ⫛ ⊍ ▷ ⨝ ⟕ ⟖ ⟗)) -(define prec-rational '(// .//)) -(define prec-power '(^ |.^| ↑ ↓ ⇵ ⟰ ⟱ ⤈ ⤉ ⤊ ⤋ ⤒ ⤓ ⥉ ⥌ ⥍ ⥏ ⥑ ⥔ ⥕ ⥘ ⥙ ⥜ ⥝ ⥠ ⥡ ⥣ ⥥ ⥮ ⥯ ↑ ↓)) +(define prec-plus (append! '($) + (add-dots '(+ - |\|| ⊕ ⊖ ⊞ ⊟ |++| ∪ ∨ ⊔ ± ∓ ∔ ∸ ≂ ≏ ⊎ ⊻ ⊽ ⋎ ⋓ ⧺ ⧻ ⨈ ⨢ ⨣ ⨤ ⨥ ⨦ ⨧ ⨨ ⨩ ⨪ ⨫ ⨬ ⨭ ⨮ ⨹ ⨺ ⩁ ⩂ ⩅ ⩊ ⩌ ⩏ ⩐ ⩒ ⩔ ⩖ ⩗ ⩛ ⩝ ⩡ ⩢ ⩣)))) +(define prec-bitshift (add-dots '(<< >> >>>))) +(define prec-times (add-dots '(* / ÷ % & ⋅ ∘ × |\\| ∩ ∧ ⊗ ⊘ ⊙ ⊚ ⊛ ⊠ ⊡ ⊓ ∗ ∙ ∤ ⅋ ≀ ⊼ ⋄ ⋆ ⋇ ⋉ ⋊ ⋋ ⋌ ⋏ ⋒ ⟑ ⦸ ⦼ ⦾ ⦿ ⧶ ⧷ ⨇ ⨰ ⨱ ⨲ ⨳ ⨴ ⨵ ⨶ ⨷ ⨸ ⨻ ⨼ ⨽ ⩀ ⩃ ⩄ ⩋ ⩍ ⩎ ⩑ ⩓ ⩕ ⩘ ⩚ ⩜ ⩞ ⩟ ⩠ ⫛ ⊍ ▷ ⨝ ⟕ ⟖ ⟗))) +(define prec-rational (add-dots '(//))) +(define prec-power (add-dots '(^ ↑ ↓ ⇵ ⟰ ⟱ ⤈ ⤉ ⤊ ⤋ ⤒ ⤓ ⥉ ⥌ ⥍ ⥏ ⥑ ⥔ ⥕ ⥘ ⥙ ⥜ ⥝ ⥠ ⥡ ⥣ ⥥ ⥮ ⥯ ↑ ↓))) (define prec-decl '(|::|)) (define prec-dot '(|.|)) @@ -69,8 +77,8 @@ ; operators that are special forms, not function names (define syntactic-operators - '(= := += -= *= /= //= .//= .*= ./= |\\=| |.\\=| ^= .^= ÷= .÷= %= .%= |\|=| &= $= => - <<= >>= >>>= -> --> |\|\|| && |.| ... |.+=| |.-=|)) + (append! (add-dots '(= += -= *= /= //= |\\=| ^= ÷= %= <<= >>= >>>=)) + '(:= --> $= |\|=| &= => && |\|\|| |.| ... ->))) (define syntactic-unary-operators '($ & |::|)) (define syntactic-op? (Set syntactic-operators)) @@ -97,7 +105,11 @@ ;; characters that can be in an operator (define opchar? (Set op-chars)) ;; characters that can follow . in an operator -(define (dot-opchar? c) (and (char? c) (string.find ".*^/\\+-'<>!=%≥≤≠÷" c))) +(define dot-opchar? (Set + (delete-duplicates + (map (lambda (op) (string.char (string op) 1)) + (filter (lambda (op) (and (dotop? op) (not (eq? op '|.|)))) + operators))))) (define operator? (Set operators)) (define initial-reserved-words '(begin while if for try return break continue From 1a53873d609c37fe346bac9d36f63e45273b590a Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Wed, 13 Jul 2016 08:19:52 -0400 Subject: [PATCH 06/10] include .|= and .&= in syntactic-operators list --- src/julia-parser.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 6e445d0cca56f..b1fd66fc4e860 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -77,8 +77,8 @@ ; operators that are special forms, not function names (define syntactic-operators - (append! (add-dots '(= += -= *= /= //= |\\=| ^= ÷= %= <<= >>= >>>=)) - '(:= --> $= |\|=| &= => && |\|\|| |.| ... ->))) + (append! (add-dots '(= += -= *= /= //= |\\=| ^= ÷= %= <<= >>= >>>= |\|=| &=)) + '(:= --> $= => && |\|\|| |.| ... ->))) (define syntactic-unary-operators '($ & |::|)) (define syntactic-op? (Set syntactic-operators)) From c0eb53f6c3dd84174f1982f75549a417e4234dfd Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Wed, 13 Jul 2016 14:54:47 -0400 Subject: [PATCH 07/10] reject .! operator --- src/julia-parser.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/julia-parser.scm b/src/julia-parser.scm index b1fd66fc4e860..3bad336c80bdc 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -198,8 +198,8 @@ (loop newop (peek-char port))) str)) str)))) - (if (equal? str "--") - (error "invalid operator \"--\"")) + (if (or (equal? str "--") (equal? str ".!")) + (error (string "invalid operator \"" str "\""))) (string->symbol str)))) (define (accum-digits c pred port lz) From 9096b7d9f79b9790aeb2a6fc3fcf38da3055fdd4 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Thu, 14 Jul 2016 20:23:39 +0100 Subject: [PATCH 08/10] NEWS for new operators --- NEWS.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS.md b/NEWS.md index b96a6f1f6568d..85c14542f7e5e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -36,6 +36,11 @@ New language features packages, but now Julia provides an API for writing generic algorithms for arbitrary indexing schemes ([#16260]). + * Many more operators now support `.` prefixes (e.g. `.≤`) ([#17393]). However, + users are discouraged from overloading these, since they are mainly parsed + in order to implement backwards compatibility with planned automatic + broadcasting of dot operators in Julia 0.6 ([#16285]). + New architectures ----------------- @@ -324,6 +329,7 @@ Deprecated or removed [#16107]: https://github.com/JuliaLang/julia/issues/16107 [#16219]: https://github.com/JuliaLang/julia/issues/16219 [#16260]: https://github.com/JuliaLang/julia/issues/16260 +[#16285]: https://github.com/JuliaLang/julia/issues/16285 [#16362]: https://github.com/JuliaLang/julia/issues/16362 [#16403]: https://github.com/JuliaLang/julia/issues/16403 [#16404]: https://github.com/JuliaLang/julia/issues/16404 @@ -342,4 +348,5 @@ Deprecated or removed [#17300]: https://github.com/JuliaLang/julia/issues/17300 [#17323]: https://github.com/JuliaLang/julia/issues/17323 [#17374]: https://github.com/JuliaLang/julia/issues/17374 +[#17393]: https://github.com/JuliaLang/julia/issues/17393 [#17402]: https://github.com/JuliaLang/julia/issues/17402 From 67517c870bbf6069fd6dc7e111748f2a85044572 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Fri, 15 Jul 2016 08:38:02 +0100 Subject: [PATCH 09/10] tests --- test/core.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/core.jl b/test/core.jl index 1e153aba58154..1f54f260bebe3 100644 --- a/test/core.jl +++ b/test/core.jl @@ -4479,3 +4479,12 @@ function h17449(v) return r[] end @test h17449(true) === :k + +# PR #17393 +for op in (:.==, :.&, :.|, :.≤) + @test parse("a $op b") == Expr(:call, op, :a, :b) +end +for op in (:.=, :.+=) + @test parse("a $op b") == Expr(op, :a, :b) +end + From 2450de810c0f2b3998e95b4051e74d6f348dd952 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Mon, 18 Jul 2016 19:31:36 -0400 Subject: [PATCH 10/10] move tests to parse.jl --- test/core.jl | 9 --------- test/parse.jl | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/test/core.jl b/test/core.jl index 1f54f260bebe3..1e153aba58154 100644 --- a/test/core.jl +++ b/test/core.jl @@ -4479,12 +4479,3 @@ function h17449(v) return r[] end @test h17449(true) === :k - -# PR #17393 -for op in (:.==, :.&, :.|, :.≤) - @test parse("a $op b") == Expr(:call, op, :a, :b) -end -for op in (:.=, :.+=) - @test parse("a $op b") == Expr(op, :a, :b) -end - diff --git a/test/parse.jl b/test/parse.jl index b9eda6f987956..bf1defd425645 100644 --- a/test/parse.jl +++ b/test/parse.jl @@ -555,3 +555,11 @@ end # error throwing branch from #10560 @test_throws ArgumentError Base.tryparse_internal(Bool, "foo", 1, 2, 10, true) + +# PR #17393 +for op in (:.==, :.&, :.|, :.≤) + @test parse("a $op b") == Expr(:call, op, :a, :b) +end +for op in (:.=, :.+=) + @test parse("a $op b") == Expr(op, :a, :b) +end