Skip to content

Commit

Permalink
Merge pull request ballerina-platform#14083 from NatashaWso2/clients-…
Browse files Browse the repository at this point in the history
…without-remotefunc

Allow client objects with no remote methods
hasithaa authored Mar 7, 2019
2 parents 6afebc8 + 045d867 commit 380e28b
Showing 5 changed files with 0 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -137,7 +137,6 @@ public enum DiagnosticCode {
ENDPOINT_INVALID_TYPE_NO_FUNCTION("endpoint.invalid.type.no.function"),
ENDPOINT_SPI_INVALID_FUNCTION("endpoint.spi.invalid.function"),

CLIENT_HAS_NO_REMOTE_FUNCTION("client.has.no.remote.function"),
REMOTE_FUNCTION_IN_NON_CLIENT_OBJECT("remote.function.in.non.client.object"),
RESOURCE_FUNCTION_IN_NON_SERVICE_OBJECT("resource.function.in.non.service.object"),
REMOTE_IN_NON_OBJECT_FUNCTION("remote.in.non.object.function"),
Original file line number Diff line number Diff line change
@@ -962,10 +962,6 @@ public void visit(BLangObjectTypeNode objectTypeNode) {
objectTypeNode.fields.forEach(field -> analyzeNode(field, objectEnv));
}
objectTypeNode.functions.forEach(e -> this.analyzeNode(e, objectEnv));
if (Symbols.isFlagOn(objectTypeNode.symbol.flags, Flags.CLIENT) && objectTypeNode.functions.stream()
.noneMatch(func -> Symbols.isFlagOn(func.symbol.flags, Flags.REMOTE))) {
this.dlog.error(objectTypeNode.pos, DiagnosticCode.CLIENT_HAS_NO_REMOTE_FUNCTION);
}
}

private void analyseType(BType type, DiagnosticPos pos) {
Original file line number Diff line number Diff line change
@@ -503,9 +503,6 @@ error.service.invalid.endpoint.type=\
error.service.service.type.required.anonymous=\
cannot infer type of the anonymous endpoint, requires a valid service type for service {0}

error.client.has.no.remote.function=\
client objects requires at least one remote function

error.remote.function.in.non.client.object=\
a remote function in a non client object

Original file line number Diff line number Diff line change
@@ -126,9 +126,6 @@ public void testRemoteBasicsNegative() {

BAssertUtil.validateError(compileResult, errIdx++, "a remote function in a non client object", 154, 5);
BAssertUtil.validateError(compileResult, errIdx++, "a remote function in a non client object", 163, 5);
BAssertUtil
.validateError(compileResult, errIdx++, "client objects requires at least one remote function", 170, 5);

Assert.assertEquals(compileResult.getErrorCount(), errIdx);
}
}
Original file line number Diff line number Diff line change
@@ -164,18 +164,6 @@ type Baz object {
}
};

// client objects requires at least one remote function
type Bax client object {

function nonAction1(float f) returns string {
return "done";
}

function nonAction2(float f) returns string {
return "done";
}
};

type dummy object {

Foo ff = new;

0 comments on commit 380e28b

Please sign in to comment.