Files
swift-mirror/test/constructor.swift
Doug Gregor b5a848e8b2 <rdar://problem/11926374> Only introduce the implicit, memberwise struct constructor when there is no similar constructor within the struct declaration.
For the implicit memberwise struct constructor to be suppressed, one
has to write a constructor with the same parameters (names, types, and
order) as the instance variables of the struct.


Swift SVN r4819
2013-04-19 00:10:46 +00:00

27 lines
283 B
Swift

// RUN: %swift -parse %s -verify
struct X {
constructor() {}
}
X()
struct Y {
var i : Int, f : Float
constructor(i : Int, f : Float) {}
}
Y(1, 1.5)
struct Z {
var a : Int
var b : Int
constructor (a : Int, b : Int = 5) {
this.a = a
this.b = b
}
}
Z(1, 2)