mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This change makes us treat it exactly as we do 'init'. We don't allow renaming the base name,
and don't fail if the basename doesn't match for calls.
Also:
- explicit init calls/references like `MyType.init(42)` are now reported with
'init' as a keywordBase range, rather than nothing.
- cursor info no longer reports rename as available on init/callAsFunction
calls without arguments, as there's nothing to rename in that case.
- Improved detection of when a referenced function is a call (rather than
reference) across syntactic rename, cursor-info, and indexing.
Resolves rdar://problem/60340429
15 lines
1018 B
Plaintext
15 lines
1018 B
Plaintext
struct Adder {
|
|
var base: Int
|
|
func /*test:def*/<keywordBase>callAsFunction</keywordBase>(<arglabel index=0>x</arglabel><param index=0></param>: Int, <arglabel index=1>y</arglabel><param index=1></param>: Int) -> Adder {
|
|
return self
|
|
}
|
|
}
|
|
|
|
let add3 = Adder(base: 3)
|
|
_ = add3/*test:call*/(<callarg index=0>x</callarg><callcolon index=0>: </callcolon>10, <callarg index=1>y</callarg><callcolon index=1>: </callcolon>11)
|
|
_ = add3 . /*test:call*/<keywordBase>callAsFunction</keywordBase>(<callarg index=0>x</callarg><callcolon index=0>: </callcolon>10, <callarg index=1>y</callarg><callcolon index=1>: </callcolon>11)
|
|
_ = add3 . /*test:ref*/<keywordBase>callAsFunction</keywordBase>(<sel index=0>x</sel>:<sel index=1>y</sel>:)
|
|
_ = add3 . /*test:ref*/<keywordBase>callAsFunction</keywordBase>
|
|
_ = (add3 . /*test:call*/<keywordBase>callAsFunction</keywordBase>())/*test:call*/(<callarg index=0>x</callarg><callcolon index=0>: </callcolon>10, <callarg index=1>y</callarg><callcolon index=1>: </callcolon>11)
|
|
|