blob: 02353c8708572c21cf1a1f8e0c9a4b732a98c2e0 [file] [log] [blame]
/**
## 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" | "interface") SimpleName
typeParameters?
primaryConstructor?
(":" annotations delegationSpecifier{","})?
typeConstraints
(classBody? | enumClassBody)
;
primaryConstructor
: (modifiers "constructor")? ("(" functionParameter{","} ")")
;
classBody
: ("{" members "}")?
;
members
: 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
;
/**
See [Generic constraints](generics.html#generic-constraints)
*/