Skip to content

Commit

Permalink
[Import as member] CoreGraphics: Import global vars onto classes
Browse files Browse the repository at this point in the history
With support from 16baa6, we can now use correct inference bahavior,
which is to import global variables as members on classes.
  • Loading branch information
milseman committed Apr 12, 2016
1 parent 16baa62 commit ba431a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
10 changes: 0 additions & 10 deletions apinotes/CoreGraphics.apinotes
Original file line number Diff line number Diff line change
Expand Up @@ -326,16 +326,6 @@ Globals:
Availability: nonswift
- Name: kCGColorSpaceGenericRGB
Availability: nonswift
# The below are left alone, due to an unknown bug
# FIXME: fix me
- Name: kCGColorBlack
SwiftName: "kCGColorBlack"
- Name: kCGColorWhite
SwiftName: "kCGColorWhite"
# TODO: clear as well, but for now it's useful for testing
- Name: kCGColorSpaceSRGB
SwiftName: "kCGColorSpaceSRGB"
# TODO: other color spaces as well, but for now it's useful for testing

#
# Enums
Expand Down
4 changes: 2 additions & 2 deletions test/Interpreter/SDK/CALayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func hangCanary(_ o: AnyObject) {

class FooLayer: CALayer {
var black: CGColor
var white: CGColor = CGColor.constantColorForName(kCGColorWhite)!
var white: CGColor = CGColor.constantColorForName(CGColor.white)!

override init() {
black = CGColor.constantColorForName(kCGColorBlack)!
black = CGColor.constantColorForName(CGColor.black)!
super.init()
hangCanary(self)
}
Expand Down
6 changes: 3 additions & 3 deletions test/Interpreter/SDK/CGImportAsMember.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import CoreGraphics

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

// FIXME: this triggers an assert in SILVerifier
static var clear = CGColor.constantColorForName(CGColor.clear)!
Expand All @@ -17,7 +17,7 @@ class Colors {
print("Colors") // CHECK: Colors
print(black) // CHECK: Generic Gray Profile
print(white) // CHECK: Generic Gray Profile
print(clear)
print(clear) // CHECK: Generic Gray Profile
}
}

Expand Down

0 comments on commit ba431a9

Please sign in to comment.