This test verifies that the overloaded constructor shadows the automatically generated constructor.
The call to the constructor uses a single positional argument. This makes the potential call to the default constructor invalid. Therefore, the ambiguity is lifted by there being a single valid constructor.
I suggest we move the default binding from re to im:
Integer re;
Integer im = 1;
instead of:
Integer re = 1;
Integer im;
In this case, both calls are valid, and we test that the overloaded constructor properly shadows the automatically generated one.
This test verifies that the overloaded constructor shadows the automatically generated constructor. The call to the constructor uses a single positional argument. This makes the potential call to the default constructor invalid. Therefore, the ambiguity is lifted by there being a single valid constructor.
I suggest we move the default binding from
re
toim
:instead of:
In this case, both calls are valid, and we test that the overloaded constructor properly shadows the automatically generated one.