diff --git a/examples/.idea/misc.xml b/examples/.idea/misc.xml
index 778bf31bc07..dfc122f5da0 100644
--- a/examples/.idea/misc.xml
+++ b/examples/.idea/misc.xml
@@ -3,6 +3,9 @@
+
+
+
diff --git a/examples/.idea/projectCodeStyle.xml b/examples/.idea/projectCodeStyle.xml
index 8b60e241aaf..c621643589d 100644
--- a/examples/.idea/projectCodeStyle.xml
+++ b/examples/.idea/projectCodeStyle.xml
@@ -11,6 +11,7 @@
+
@@ -20,6 +21,7 @@
+
@@ -29,6 +31,7 @@
+
diff --git a/examples/examples.iml b/examples/examples.iml
index 26a958a9c8a..d5c07432750 100644
--- a/examples/examples.iml
+++ b/examples/examples.iml
@@ -5,7 +5,7 @@
-
+
diff --git a/examples/src/PolymorphicClassObjects.jetl b/examples/src/PolymorphicClassObjects.jetl
index e69de29bb2d..d9810048d82 100644
--- a/examples/src/PolymorphicClassObjects.jetl
+++ b/examples/src/PolymorphicClassObjects.jetl
@@ -0,0 +1,31 @@
+virtual class Builder {
+ [operator] fun plusAssign(item : E)
+ fun result() : R
+}
+
+virtual class Buildable {
+ fun newBuilder() : Builder
+}
+
+class List {
+
+ class object Buildable {
+ override fun newBuilder() : Builder
+
+ }
+
+}
+
+extension Map for T
+ where
+ T : Iterable,
+ class object T : Buildable {
+
+ fun map(f : {(E) : R}) : T = {
+ val builder = T.newBuilder()
+ for (e in this) {
+ builder += f(e)
+ }
+ builder.result()
+ }
+}
\ No newline at end of file
diff --git a/grammar/src/class_members.grm b/grammar/src/class_members.grm
index d0904bc0878..143c9243f0f 100644
--- a/grammar/src/class_members.grm
+++ b/grammar/src/class_members.grm
@@ -37,6 +37,8 @@ memberDeclaration
: function
: property
: class
+ : extension
+ : typedef
;
classObject
diff --git a/grammar/src/expressions.grm b/grammar/src/expressions.grm
index 0fe5ec86337..ed0c6054f16 100644
--- a/grammar/src/expressions.grm
+++ b/grammar/src/expressions.grm
@@ -33,6 +33,9 @@ literalConstant
declaration
: function
: property
+ : extension
+ : class
+ : typedef
;
expressionWithPrecedences // See the precedence table, everything associates to the left
diff --git a/grammar/src/modifiers.grm b/grammar/src/modifiers.grm
index 7f9bb4a73ae..9c891bdfcf9 100644
--- a/grammar/src/modifiers.grm
+++ b/grammar/src/modifiers.grm
@@ -43,5 +43,4 @@ parameterKind
: "lazy"
: "out"
: "ref"
- ;
-
+ ;
\ No newline at end of file
diff --git a/grammar/src/types.grm b/grammar/src/types.grm
index 99561cddcd5..5318da251c7 100644
--- a/grammar/src/types.grm
+++ b/grammar/src/types.grm
@@ -17,7 +17,15 @@ type
;
userType
- : SimpleName{"."} ("<" (modifiers type){","} ">")?
+ : (SimpleName ".")* simpleUserType{"."}
+ ;
+
+simpleUserType
+ : SimpleName ("<" (optionalProjection type){","} ">")?
+ ;
+
+optionalProjection
+ : modifiers
;
functionType