Files
swift-mirror/test/Constraints/assignment.swift
Doug Gregor 1224ff5b8e Extend the constraint-based type checker to support assignment
statements. The approach is fairly simple: generate constraints for
both the destination and source expressions, then turn the destination
type into a type containing only rvalues and convert the source
expression to that type.


Swift SVN r2925
2012-10-02 22:40:33 +00:00

22 lines
368 B
Swift

// RUN: %swift -parse -verify -constraint-checker %s
var i : Int
var f : Float
func getIntFloat() -> (Int, Float)
var ift : (Int, Float)
var ovl : Int
var ovl : Float
var slice : Int[]
i = i
i = 1
(i, f) = getIntFloat()
(i, f) = ift
(i, f) = (i, f)
(ovl, ovl) = ift
(ovl, ovl) = (i, f)
slice[7] = i
slice[7] = f // expected-error{{assignment does not type-check}}