Files
swift-mirror/test/Constraints/default_literals.swift
Doug Gregor d09688d9e1 When we don't have any useful upper or lower bounds on any type
variables to pick as potential bindings, try the default literal
types corresponding to literal constraints on a type variable.


Swift SVN r2883
2012-09-20 22:10:22 +00:00

19 lines
565 B
Swift

// RUN: %swift -verify -constraint-checker -debug-constraints %s > %t
// RUN: FileCheck %s < %t
// CHECK: ---Solution---
// CHECK: Assumptions:
// CHECK: assuming $T0 == IntegerLiteralType
// CHECK: Type Variables:
// CHECK: $T0 as IntegerLiteralType
// CHECK: Constraints:
// CHECK: SOLVED (completely)
var i1 = 1
// CHECK: SOLVED (completely)
// CHECK: Found 2 potential solutions.
// FIXME: There are multiple interpretations. Should we prefer the one that
// uses default types?
var i2 = 1 + 2.0 + 1 // expected-error{{expression does not type-check}}