Never allow typedefs with the same names as classes
Right now, we allowed it as long as the typedef was for the same class. (Oversight.) This involved a few error message changes in existing tests.
Esse commit está contido em:
@@ -684,7 +684,8 @@ void Unit::defTypedef(Id id) {
|
||||
|
||||
// There might also be a class with this name already.
|
||||
if (Class* cls = nameList->getCachedClass()) {
|
||||
checkExistingClass(cls);
|
||||
raise_error("The name %s is already defined as a class",
|
||||
thisType->m_name->data());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
HipHop Fatal error: The type Existing is already defined to a different class (Existing) in %s on line 6
|
||||
HipHop Fatal error: The name Existing is already defined as a class in %s on line 6
|
||||
|
||||
@@ -1 +1 @@
|
||||
HipHop Fatal error: The type Something is already defined to a different class (Something) in %s on line 4
|
||||
HipHop Fatal error: The name Something is already defined as a class in %s on line 4
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?hh
|
||||
|
||||
class Foo {
|
||||
}
|
||||
|
||||
type Foo = Foo;
|
||||
|
||||
function main() {}
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Fatal error: The name Foo is already defined as a class in %s on line 8
|
||||
Referência em uma Nova Issue
Bloquear um usuário