Skip to content

Commit

Permalink
fix: output mismatch in missing return error
Browse files Browse the repository at this point in the history
  • Loading branch information
nedpals committed Feb 1, 2024
1 parent 8869e67 commit b9c31a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion error_templates/java/missing_return_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var MissingReturnError = lib.ErrorTemplate{
// nearest sym will be at the last
valueToReturn := getDefaultValueForType(expectedTypeSym)
if len(symbolsForReturn) != 0 {
nearestSym := symbolsForReturn[len(symbolsForReturn)-1]
nearestSym := symbolsForReturn[0]
valueToReturn = nearestSym.Name()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Since the `addNumbers` method is declared to return an `int`, you need to provid
public class MissingReturn {
public int addNumbers(int a, int b) {
// Missing return statement
+ return b;
+ return a;
}

```
Expand Down

0 comments on commit b9c31a8

Please sign in to comment.