Local/inner types
This commit is contained in:
Generated
+3
@@ -3,6 +3,9 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</component>
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="OPTION_SCOPE" value="protected" />
|
||||
|
||||
Generated
+3
@@ -11,6 +11,7 @@
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
<ADDITIONAL_INDENT_OPTIONS fileType="java">
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
@@ -20,6 +21,7 @@
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
<ADDITIONAL_INDENT_OPTIONS fileType="xml">
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
@@ -29,6 +31,7 @@
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
</value>
|
||||
</option>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.6" jdkType="JavaSDK" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
virtual class Builder<E, R> {
|
||||
[operator] fun plusAssign(item : E)
|
||||
fun result() : R
|
||||
}
|
||||
|
||||
virtual class Buildable {
|
||||
fun newBuilder<E, R>() : Builder<E, R>
|
||||
}
|
||||
|
||||
class List<T> {
|
||||
|
||||
class object Buildable {
|
||||
override fun newBuilder<E, R>() : Builder<E, R>
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension Map<E> for T
|
||||
where
|
||||
T : Iterable<E>,
|
||||
class object T : Buildable<E, T> {
|
||||
|
||||
fun map<R>(f : {(E) : R}) : T<R> = {
|
||||
val builder = T.newBuilder()
|
||||
for (e in this) {
|
||||
builder += f(e)
|
||||
}
|
||||
builder.result()
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,8 @@ memberDeclaration
|
||||
: function
|
||||
: property
|
||||
: class
|
||||
: extension
|
||||
: typedef
|
||||
;
|
||||
|
||||
classObject
|
||||
|
||||
@@ -33,6 +33,9 @@ literalConstant
|
||||
declaration
|
||||
: function
|
||||
: property
|
||||
: extension
|
||||
: class
|
||||
: typedef
|
||||
;
|
||||
|
||||
expressionWithPrecedences // See the precedence table, everything associates to the left
|
||||
|
||||
@@ -43,5 +43,4 @@ parameterKind
|
||||
: "lazy"
|
||||
: "out"
|
||||
: "ref"
|
||||
;
|
||||
|
||||
;
|
||||
@@ -17,7 +17,15 @@ type
|
||||
;
|
||||
|
||||
userType
|
||||
: SimpleName{"."} ("<" (modifiers type){","} ">")?
|
||||
: (SimpleName ".")* simpleUserType{"."}
|
||||
;
|
||||
|
||||
simpleUserType
|
||||
: SimpleName ("<" (optionalProjection type){","} ">")?
|
||||
;
|
||||
|
||||
optionalProjection
|
||||
: modifiers
|
||||
;
|
||||
|
||||
functionType
|
||||
|
||||
Reference in New Issue
Block a user