Skip to content

[test] Add constraint test for SR-8075. #17552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions test/Constraints/generics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -578,3 +578,17 @@ func rdar39616039() {
var c = foo(default: 42.0, ["foo": Float(0)])
c += 1 // ok
}

// https://bugs.swift.org/browse/SR-8075

func sr8075() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use two-space indent for consistency with the rest of the file. Also these days we generally put random crasher test cases into validation-test/compiler_crashers_2_fixed/

Copy link
Contributor Author

@huonw huonw Jun 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes; this wasn't a crasher: https://bugs.swift.org/browse/SR-8075.

struct UIFont {
init(ofSize: Float) {}
}

func switchOnCategory<T>(_ categoryToValue: [Int: T]) -> T {
fatalError()
}

let _: UIFont = .init(ofSize: switchOnCategory([0: 15.5, 1: 20.5]))
}