forked from Mirror/wren
@ -1,8 +0,0 @@
|
||||
class Foo {
|
||||
toString { "Foo" }
|
||||
}
|
||||
|
||||
// Classes get an argument-less "new()" by default.
|
||||
var foo = Foo.new()
|
||||
IO.print(foo is Foo) // expect: true
|
||||
IO.print(foo.toString) // expect: Foo
|
||||
@ -1,9 +0,0 @@
|
||||
class Foo {
|
||||
construct new() {
|
||||
IO.print("Foo.new()")
|
||||
}
|
||||
}
|
||||
|
||||
class Bar is Foo {}
|
||||
|
||||
Bar.new() // expect: Foo.new()
|
||||
@ -1,6 +1,4 @@
|
||||
class Foo {
|
||||
construct real() {}
|
||||
}
|
||||
class Foo {}
|
||||
|
||||
// Classes do not get an argument-less "new()" if they define a constructor.
|
||||
// Classes do not get a constructor by default.
|
||||
var foo = Foo.new() // expect runtime error: Foo metaclass does not implement 'new()'.
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
// Tests that Object implements new(). The only way to call that is through a
|
||||
// super() call in a subclass, so this does that.
|
||||
|
||||
class Foo {
|
||||
construct new() {
|
||||
super() // Should not cause a no method error.
|
||||
IO.print("ok")
|
||||
}
|
||||
}
|
||||
|
||||
Foo.new() // expect: ok
|
||||
Reference in New Issue
Block a user