§2.3.4.(b) Definite ambiguity

A definite ambiguity is given if

Effect:
Definite ambiguity is a compile time error.

A compiler may still choose to make this error configurable/suppressable (using the warning token "def-bind-ambiguity") to account for corner cases that may work as desired despite a definite binding ambiguity. Such corner cases may arise if lifting already finds an appropriate role in the cache or if an (indirect) subrole of the ambiguously bound role is an unambiguous lift target for the concrete type of the base object at run-time.

Example code (Definite Ambiguity):
1
team class MyTeam {
2
  public class SuperRole playedBy MyBase {...}
3
  public class SubRoleA extends SuperRole playedBy SubBase {...}
4
  public class SubRoleB extends SuperRole playedBy SubBase {...}
5
6
  public void useSuperRole(SubBase as SuperRole r) {...}
7
}