Skip to content

Commit 86f3ebd

Browse files
authoredFeb 7, 2017
Merge pull request #20308 from JuliaLang/jb/innerctors
deprecate special "inner constructor" syntax
2 parents 8faae22 + 6791752 commit 86f3ebd

Some content is hidden

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

58 files changed

+298
-225
lines changed
 

‎NEWS.md

+12
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ New language features
2222
Language changes
2323
----------------
2424

25+
* "Inner constructor" syntax for parametric types is deprecated. For example,
26+
in this definition:
27+
```
28+
type Foo{T,S<:Real}
29+
x
30+
Foo(x) = new(x)
31+
end
32+
```
33+
the syntax `Foo(x) = new(x)` actually defined a constructor for `Foo{T,S}`,
34+
i.e. the case where the type parameters are specified. For clarity, this
35+
definition now must be written as `Foo{T,S}(x) where {T,S<:Real} = new(x)`. ([#11310])
36+
2537
* Multi-line and single-line nonstandard command literals have been added. A
2638
nonstandard command literal is like a nonstandard string literal, but the
2739
syntax uses backquotes (``` ` ```) instead of double quotes, and the

‎base/LineEdit.jl

+5-4
Original file line numberDiff line numberDiff line change
@@ -1014,10 +1014,10 @@ type HistoryPrompt{T<:HistoryProvider} <: TextInterface
10141014
hp::T
10151015
complete
10161016
keymap_dict::Dict{Char,Any}
1017-
HistoryPrompt(hp) = new(hp, EmptyCompletionProvider())
1017+
HistoryPrompt{T}(hp) where T<:HistoryProvider = new(hp, EmptyCompletionProvider())
10181018
end
10191019

1020-
HistoryPrompt{T<:HistoryProvider}(hp::T) = HistoryPrompt{T}(hp)
1020+
HistoryPrompt(hp::T) where T<:HistoryProvider = HistoryPrompt{T}(hp)
10211021
init_state(terminal, p::HistoryPrompt) = SearchState(terminal, p, true, IOBuffer(), IOBuffer())
10221022

10231023
type PrefixSearchState <: ModeState
@@ -1054,10 +1054,11 @@ type PrefixHistoryPrompt{T<:HistoryProvider} <: TextInterface
10541054
parent_prompt::Prompt
10551055
complete
10561056
keymap_dict::Dict{Char,Any}
1057-
PrefixHistoryPrompt(hp, parent_prompt) = new(hp, parent_prompt, EmptyCompletionProvider())
1057+
PrefixHistoryPrompt{T}(hp, parent_prompt) where T<:HistoryProvider =
1058+
new(hp, parent_prompt, EmptyCompletionProvider())
10581059
end
10591060

1060-
PrefixHistoryPrompt{T<:HistoryProvider}(hp::T, parent_prompt) = PrefixHistoryPrompt{T}(hp, parent_prompt)
1061+
PrefixHistoryPrompt(hp::T, parent_prompt) where T<:HistoryProvider = PrefixHistoryPrompt{T}(hp, parent_prompt)
10611062
init_state(terminal, p::PrefixHistoryPrompt) = PrefixSearchState(terminal, p, "", IOBuffer())
10621063

10631064
write_prompt(terminal, s::PrefixSearchState) = write_prompt(terminal, s.histprompt.parent_prompt)

0 commit comments

Comments
 (0)
Please sign in to comment.