Failing test, some work for frontend
This commit is contained in:
@@ -693,6 +693,10 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
|
|
||||||
if (callee instanceof JetSimpleNameExpression) {
|
if (callee instanceof JetSimpleNameExpression) {
|
||||||
DeclarationDescriptor funDescriptor = bindingContext.resolveReferenceExpression((JetSimpleNameExpression) callee);
|
DeclarationDescriptor funDescriptor = bindingContext.resolveReferenceExpression((JetSimpleNameExpression) callee);
|
||||||
|
if (funDescriptor == null) {
|
||||||
|
throw new CompilationException("Cannot resolve: " + callee.getText());
|
||||||
|
}
|
||||||
|
|
||||||
if (funDescriptor instanceof ConstructorDescriptor) {
|
if (funDescriptor instanceof ConstructorDescriptor) {
|
||||||
generateConstructorCall(expression, (JetSimpleNameExpression) callee);
|
generateConstructorCall(expression, (JetSimpleNameExpression) callee);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class JetStandardClasses {
|
|||||||
ClassDescriptorImpl receiverFunction = new ClassDescriptorImpl(
|
ClassDescriptorImpl receiverFunction = new ClassDescriptorImpl(
|
||||||
STANDARD_CLASSES_NAMESPACE,
|
STANDARD_CLASSES_NAMESPACE,
|
||||||
Collections.<Annotation>emptyList(),
|
Collections.<Annotation>emptyList(),
|
||||||
"ReceiverFunction" + i);
|
"ExtensionFunction" + i);
|
||||||
List<TypeParameterDescriptor> parameters = createTypeParameters(i, receiverFunction);
|
List<TypeParameterDescriptor> parameters = createTypeParameters(i, receiverFunction);
|
||||||
parameters.add(0, TypeParameterDescriptor.createWithDefaultBound(
|
parameters.add(0, TypeParameterDescriptor.createWithDefaultBound(
|
||||||
receiverFunction,
|
receiverFunction,
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fun box() : String {
|
||||||
|
val answer = apply("OK", { String.() : Int =>
|
||||||
|
length()
|
||||||
|
})
|
||||||
|
|
||||||
|
return if (answer == 2) "OK" else "FAIL"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun apply(arg:String, f : {String.() : Int}) : Int {
|
||||||
|
return arg.f()
|
||||||
|
}
|
||||||
@@ -19,4 +19,8 @@ public class ClosuresGenTest extends CodegenTestCase {
|
|||||||
public void testClosureWithParameterAndBoxing() throws Exception {
|
public void testClosureWithParameterAndBoxing() throws Exception {
|
||||||
blackBoxFile("classes/closureWithParameterAndBoxing.jet");
|
blackBoxFile("classes/closureWithParameterAndBoxing.jet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testExtensionClosure() throws Exception {
|
||||||
|
blackBoxFile("classes/extensionClosure.jet");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user