Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KavinduZoysa committed Aug 10, 2023
1 parent da1883c commit f6f1a71
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.ballerina.compiler.api.symbols.ParameterSymbol;
import io.ballerina.compiler.api.symbols.RecordFieldSymbol;
import io.ballerina.compiler.api.symbols.RecordTypeSymbol;
import io.ballerina.compiler.api.symbols.StreamTypeSymbol;
import io.ballerina.compiler.api.symbols.Symbol;
import io.ballerina.compiler.api.symbols.SymbolKind;
import io.ballerina.compiler.api.symbols.TypeDescKind;
Expand Down Expand Up @@ -490,8 +491,11 @@ public void visit(GroupingKeyVarDeclarationNode groupingKeyVarDeclarationNode) {
public void visit(SelectClauseNode selectClauseNode) {
selectClauseNode.parent().parent().accept(this);
if (resultFound) {
if (this.returnTypeSymbol.typeKind() == TypeDescKind.ARRAY) {
TypeDescKind kind = this.returnTypeSymbol.typeKind();
if (kind == TypeDescKind.ARRAY) {
checkAndSetTypeResult(((ArrayTypeSymbol) returnTypeSymbol).memberTypeDescriptor());
} else if (kind == TypeDescKind.STREAM) {
checkAndSetTypeResult(((StreamTypeSymbol) returnTypeSymbol).typeParameter());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public Object[][] dataProvider() {
{"undefinedFunctionCodeAction28.json"},
{"undefinedFunctionCodeAction29.json"},
{"undefinedFunctionCodeAction30.json"},
{"undefinedFunctionCodeAction31.json"},
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"position": {
"line": 6,
"character": 22
},
"source": "createUndefinedFunction20.bal",
"expected": [
{
"title": "Create function 'foo(...)'",
"kind": "quickfix",
"edits": [
{
"range": {
"start": {
"line": 7,
"character": 1
},
"end": {
"line": 7,
"character": 1
}
},
"newText": "\n\nfunction foo(string letter) returns MyType {\n return {value: \"\"};\n}"
}
],
"resolvable": true,
"data": {
"extName": "org.ballerinalang.langserver.codeaction.BallerinaCodeActionExtension",
"codeActionName": "Create Function",
"fileUri": "createUndefinedFunction20.bal",
"range": {
"start": {
"line": 6,
"character": 19
},
"end": {
"line": 6,
"character": 30
}
},
"actionData": {
"key": "node.range",
"value": {
"start": {
"line": 6.0,
"character": 19.0
},
"end": {
"line": 6.0,
"character": 30.0
}
}
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type MyType record {|
string value;
|};

function func() {
stream<MyType> streamName = stream from string letter in "JohnSnow"
select foo(letter);
}

0 comments on commit f6f1a71

Please sign in to comment.