1
0
forked from Mirror/wren

Add Class.supertype.

Thanks, Michel!
This commit is contained in:
Bob Nystrom
2015-03-14 09:48:45 -07:00
parent 26fb5eb525
commit 5459993857
3 changed files with 46 additions and 0 deletions

15
test/class/supertype.wren Normal file
View File

@ -0,0 +1,15 @@
class Foo {}
class Bar is Foo {}
class Baz is Bar {}
// A class with no explicit superclass inherits Object.
IO.print(Foo.supertype == Object) // expect: true
// Otherwise, it's the superclass.
IO.print(Bar.supertype == Foo) // expect: true
IO.print(Baz.supertype == Bar) // expect: true
// Object has no supertype.
IO.print(Object.supertype) // expect: null