Files
swift-mirror/test/Constraints/super_constructor.swift
Joe Groff 0a16e6e1f6 Sema: super.constructor in the constraint checker.
Set up constraints and solution application for SuperConstructorRefCallExpr.

Swift SVN r3916
2013-01-31 23:17:32 +00:00

51 lines
929 B
Swift

// RUN: %swift %s -constraint-checker -parse-as-library -verify
struct S {
constructor() {
super.constructor() // expected-error{{'super.constructor' cannot be called in a constructor for a non-class type}}
}
}
class D : B {
func foo() {
super.constructor() // expected-error{{'super.constructor' cannot be called outside of a constructor}}
}
constructor(a:Int) {
super.constructor()
}
constructor(e:Int) {
super.constructor('x') // expected-error{{}}
}
constructor(f:Int) {
super.constructor(a='x')
}
constructor(g:Int) {
super.constructor("aoeu") // expected-error{{}}
}
}
class B {
var foo : (bar:Int)
func bar() {}
constructor() {
}
constructor(x:Int) {
}
constructor(a:Char) {
}
constructor(b:Char) {
}
constructor(z:Float) {
super.constructor() // expected-error{{'super.constructor' cannot be called in a root class constructor}}
}
}