Skip to content

Commit

Permalink
Remove type-unlimited unary + and * (#45320)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarrasch authored May 17, 2022
1 parent f2a2664 commit 990b1f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Language changes
for reading from and writing to globals. `getglobal` should now be preferred for accessing globals over
`getfield`. ([#44137])
* A few basic operators have been generalized to more naturally support vector space structures:
`+(x) = x`, unary minus falls back to scalar multiplication with -1, `-(x) = Int8(-1)*x`,
unary minus falls back to scalar multiplication with -1, `-(x) = Int8(-1)*x`,
binary minus falls back to addition `-(x, y) = x + (-y)`, and, at the most generic level,
left- and right-division fall back to multiplication with the inverse from left and right,
respectively, as stated in the docstring. ([#44564])
Expand Down
4 changes: 2 additions & 2 deletions base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,10 @@ julia> identity("Well, what did you expect?")
"""
identity(@nospecialize x) = x

+(x) = x
+(x::Number) = x
-(x) = Int8(-1)*x
-(x, y) = x + (-y)
*(x) = x
*(x::Number) = x
(&)(x::Integer) = x
(|)(x::Integer) = x
xor(x::Integer) = x
Expand Down

0 comments on commit 990b1f3

Please sign in to comment.