blob: 7449b3a57109823db12466c1fc5e27c2a78d645e [file] [log] [blame] [edit]
/**
## Classes
See [Classes and Inheritance](classes.html)
*/
/*
internal class Example<X, T : Comparable<X>>(protected val x : Foo<X, T>, y : Some)
: Bar(x), Foo<X, T> by x, IAbstractSome by y.asAbstract()
where
T : Function<Object, Object>
{
// members
}
*/
class
: modifiers ("class" | "trait") SimpleName
typeParameters?
modifiers ("(" functionParameter{","} ")")?
(":" annotations delegationSpecifier{","})?
typeConstraints
(classBody? | enumClassBody)
;
classBody
: ("{" memberDeclaration* "}")?
;
delegationSpecifier
: constructorInvocation // type and constructor arguments
: userType
: explicitDelegation
;
explicitDelegation
: userType "by" expression // internal this expression no foo {bar} is allowed
;
typeParameters
: "<" typeParameter{","} ">"
;
typeParameter
: modifiers SimpleName (":" userType)?
;
/**
See [Generic classes](generics.html)
*/
typeConstraints
: ("where" typeConstraint{","})?
;
typeConstraint
: annotations SimpleName ":" type
: annotations "class" "object" SimpleName ":" type
;
/**
See [Generic constraints](generics.html#generic-constraints)
*/