[overlay] Hide the _ExpressibleByColorLiteral initializer from code completion.

Fixes: <rdar://problem/32726800>
This commit is contained in:
Max Moiseev
2017-07-10 14:05:05 -07:00
parent d87cb5bc98
commit 391d49a31e
10 changed files with 10 additions and 10 deletions

View File

@@ -172,7 +172,7 @@ DeclName TypeChecker::getObjectLiteralConstructorName(ObjectLiteralExpr *expr) {
switch (expr->getLiteralKind()) { switch (expr->getLiteralKind()) {
case ObjectLiteralExpr::colorLiteral: { case ObjectLiteralExpr::colorLiteral: {
return DeclName(Context, Context.Id_init, return DeclName(Context, Context.Id_init,
{ Context.getIdentifier("colorLiteralRed"), { Context.getIdentifier("_colorLiteralRed"),
Context.getIdentifier("green"), Context.getIdentifier("green"),
Context.getIdentifier("blue"), Context.getIdentifier("blue"),
Context.getIdentifier("alpha") }); Context.getIdentifier("alpha") });

View File

@@ -79,7 +79,7 @@ extension NSApplication {
extension NSColor : _ExpressibleByColorLiteral { extension NSColor : _ExpressibleByColorLiteral {
@nonobjc @nonobjc
public required convenience init(colorLiteralRed red: Float, green: Float, public required convenience init(_colorLiteralRed red: Float, green: Float,
blue: Float, alpha: Float) { blue: Float, alpha: Float) {
self.init(srgbRed: CGFloat(red), green: CGFloat(green), self.init(srgbRed: CGFloat(red), green: CGFloat(green),
blue: CGFloat(blue), alpha: CGFloat(alpha)) blue: CGFloat(blue), alpha: CGFloat(alpha))

View File

@@ -53,7 +53,7 @@ public protocol _CGColorInitTrampoline {
} }
extension _CGColorInitTrampoline { extension _CGColorInitTrampoline {
public init(colorLiteralRed red: Float, green: Float, blue: Float, public init(_colorLiteralRed red: Float, green: Float, blue: Float,
alpha: Float) { alpha: Float) {
self.init(red: CGFloat(red), green: CGFloat(green), blue: CGFloat(blue), self.init(red: CGFloat(red), green: CGFloat(green), blue: CGFloat(blue),
alpha: CGFloat(alpha)) alpha: CGFloat(alpha))

View File

@@ -216,7 +216,7 @@ extension UIView : _DefaultCustomPlaygroundQuickLookable {
#endif #endif
extension UIColor : _ExpressibleByColorLiteral { extension UIColor : _ExpressibleByColorLiteral {
@nonobjc public required convenience init(colorLiteralRed red: Float, @nonobjc public required convenience init(_colorLiteralRed red: Float,
green: Float, green: Float,
blue: Float, alpha: Float) { blue: Float, alpha: Float) {
self.init(red: CGFloat(red), green: CGFloat(green), self.init(red: CGFloat(red), green: CGFloat(green),

View File

@@ -744,7 +744,7 @@ public protocol _ExpressibleByColorLiteral {
/// ///
/// Do not call this initializer directly. Instead, initialize a variable or /// Do not call this initializer directly. Instead, initialize a variable or
/// constant using a color literal. /// constant using a color literal.
init(colorLiteralRed red: Float, green: Float, blue: Float, alpha: Float) init(_colorLiteralRed red: Float, green: Float, blue: Float, alpha: Float)
} }
/// A type that can be initialized using an image literal (e.g. /// A type that can be initialized using an image literal (e.g.

View File

@@ -62,7 +62,7 @@ func giveMeAString() -> Int {
// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: append({#contentsOf: Sequence#})[#Void#]{{; name=.+$}} // LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: append({#contentsOf: Sequence#})[#Void#]{{; name=.+$}}
struct MyColor: _ExpressibleByColorLiteral { struct MyColor: _ExpressibleByColorLiteral {
init(colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) { red = colorLiteralRed } init(_colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) { red = colorLiteralRed }
var red: Float var red: Float
} }
public typealias _ColorLiteralType = MyColor public typealias _ColorLiteralType = MyColor

View File

@@ -201,7 +201,7 @@ func testTuple2() {
// TUPLE_2: Literal[Tuple]/None/TypeRelation[Identical]: ({#(values)#})[#(MyInt1, MyString1, MyDouble1)#]; // TUPLE_2: Literal[Tuple]/None/TypeRelation[Identical]: ({#(values)#})[#(MyInt1, MyString1, MyDouble1)#];
struct MyColor1: _ExpressibleByColorLiteral { struct MyColor1: _ExpressibleByColorLiteral {
init(colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) {} init(_colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) {}
} }
func testColor0() { func testColor0() {
let x: Int = #^COLOR_0^# let x: Int = #^COLOR_0^#

View File

@@ -1,7 +1,7 @@
// RUN: %swift-ide-test -structure -source-filename %s | %FileCheck %s // RUN: %swift-ide-test -structure -source-filename %s | %FileCheck %s
struct S: _ExpressibleByColorLiteral { struct S: _ExpressibleByColorLiteral {
init(colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) {} init(_colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) {}
} }
// CHECK: <gvar>let <name>y</name>: S = <object-literal-expression>#<name>colorLiteral</name>(<arg><name>red</name>: 1</arg>, <arg><name>green</name>: 0</arg>, <arg><name>blue</name>: 0</arg>, <arg><name>alpha</name>: 1</arg>)</object-literal-expression></gvar> // CHECK: <gvar>let <name>y</name>: S = <object-literal-expression>#<name>colorLiteral</name>(<arg><name>red</name>: 1</arg>, <arg><name>green</name>: 0</arg>, <arg><name>blue</name>: 0</arg>, <arg><name>alpha</name>: 1</arg>)</object-literal-expression></gvar>

View File

@@ -2,7 +2,7 @@
// REQUIRES: OS=ios // REQUIRES: OS=ios
struct S: _ExpressibleByColorLiteral { struct S: _ExpressibleByColorLiteral {
init(colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) {} init(_colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) {}
} }
let y: S = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1) let y: S = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1)

View File

@@ -2,7 +2,7 @@
// REQUIRES: OS=macosx // REQUIRES: OS=macosx
struct S: _ExpressibleByColorLiteral { struct S: _ExpressibleByColorLiteral {
init(colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) {} init(_colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) {}
} }
let y: S = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1) let y: S = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1)