Skip to content

Commit

Permalink
Fix: issue 4492 resolve LambdaExpr has NullPointException
Browse files Browse the repository at this point in the history
  • Loading branch information
jlerbsc committed Jul 11, 2024
1 parent aa60a2b commit 45c7c35
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public ResolvedType lub(Set<ResolvedType> types) {
throw new IllegalArgumentException();
}

// If there is only one type then the lub is the type itself
if (types.size() == 1) {
return types.iterator().next();
}

// The direct supertypes of the null type are all reference types other than the null type itself.
// One way to handle this case is to remove the type null from the list of types.
// Provides the concret type of Lazy type if needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ public void lub_of_one_element_is_itself() {
assertEquals(lub, exception);
}

@Test
public void lub_of_one_null_element_is_itself() {
ResolvedType lub = leastUpperBound(NullType.INSTANCE);
assertEquals(lub, lub);
}

@Test
public void lub_should_fail_if_no_type_provided() {
try {
Expand Down

0 comments on commit 45c7c35

Please sign in to comment.