@@ -1309,7 +1309,15 @@ export class Program extends DiagnosticEmitter {
13091309 Range . join ( thisPrototype . identifierNode . range , extendsNode . range )
13101310 ) ;
13111311 }
1312- thisPrototype . basePrototype = basePrototype ;
1312+ if ( ! thisPrototype . extends ( basePrototype ) ) {
1313+ thisPrototype . basePrototype = basePrototype ;
1314+ } else {
1315+ this . error (
1316+ DiagnosticCode . _0_is_referenced_directly_or_indirectly_in_its_own_base_expression ,
1317+ basePrototype . identifierNode . range ,
1318+ basePrototype . identifierNode . text ,
1319+ ) ;
1320+ }
13131321 } else {
13141322 this . error (
13151323 DiagnosticCode . A_class_may_only_extend_another_class ,
@@ -1318,7 +1326,16 @@ export class Program extends DiagnosticEmitter {
13181326 }
13191327 } else if ( thisPrototype . kind == ElementKind . INTERFACE_PROTOTYPE ) {
13201328 if ( baseElement . kind == ElementKind . INTERFACE_PROTOTYPE ) {
1321- thisPrototype . basePrototype = < InterfacePrototype > baseElement ;
1329+ const basePrototype = < InterfacePrototype > baseElement ;
1330+ if ( ! thisPrototype . extends ( basePrototype ) ) {
1331+ thisPrototype . basePrototype = basePrototype ;
1332+ } else {
1333+ this . error (
1334+ DiagnosticCode . _0_is_referenced_directly_or_indirectly_in_its_own_base_expression ,
1335+ basePrototype . identifierNode . range ,
1336+ basePrototype . identifierNode . text ,
1337+ ) ;
1338+ }
13221339 } else {
13231340 this . error (
13241341 DiagnosticCode . An_interface_can_only_extend_an_interface ,
0 commit comments