Skip to content

Commit ba431a9

Browse files
committed
[Import as member] CoreGraphics: Import global vars onto classes
With support from 16baa6, we can now use correct inference bahavior, which is to import global variables as members on classes.
1 parent 16baa62 commit ba431a9

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

apinotes/CoreGraphics.apinotes

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,16 +326,6 @@ Globals:
326326
Availability: nonswift
327327
- Name: kCGColorSpaceGenericRGB
328328
Availability: nonswift
329-
# The below are left alone, due to an unknown bug
330-
# FIXME: fix me
331-
- Name: kCGColorBlack
332-
SwiftName: "kCGColorBlack"
333-
- Name: kCGColorWhite
334-
SwiftName: "kCGColorWhite"
335-
# TODO: clear as well, but for now it's useful for testing
336-
- Name: kCGColorSpaceSRGB
337-
SwiftName: "kCGColorSpaceSRGB"
338-
# TODO: other color spaces as well, but for now it's useful for testing
339329

340330
#
341331
# Enums

test/Interpreter/SDK/CALayer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ func hangCanary(_ o: AnyObject) {
2222

2323
class FooLayer: CALayer {
2424
var black: CGColor
25-
var white: CGColor = CGColor.constantColorForName(kCGColorWhite)!
25+
var white: CGColor = CGColor.constantColorForName(CGColor.white)!
2626

2727
override init() {
28-
black = CGColor.constantColorForName(kCGColorBlack)!
28+
black = CGColor.constantColorForName(CGColor.black)!
2929
super.init()
3030
hangCanary(self)
3131
}

test/Interpreter/SDK/CGImportAsMember.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import CoreGraphics
77

88
class Colors {
99
// TODO: when issue is fixed, migrate these to CGColor class properties
10-
static var black = CGColor.constantColorForName(kCGColorBlack)!
11-
static var white = CGColor.constantColorForName(kCGColorWhite)!
10+
static var black = CGColor.constantColorForName(CGColor.black)!
11+
static var white = CGColor.constantColorForName(CGColor.white)!
1212

1313
// FIXME: this triggers an assert in SILVerifier
1414
static var clear = CGColor.constantColorForName(CGColor.clear)!
@@ -17,7 +17,7 @@ class Colors {
1717
print("Colors") // CHECK: Colors
1818
print(black) // CHECK: Generic Gray Profile
1919
print(white) // CHECK: Generic Gray Profile
20-
print(clear)
20+
print(clear) // CHECK: Generic Gray Profile
2121
}
2222
}
2323

0 commit comments

Comments
 (0)