@@ -449,132 +449,6 @@ extern (C++) final class AliasDeclaration : Declaration
449
449
return sa;
450
450
}
451
451
452
- override bool overloadInsert (Dsymbol s)
453
- {
454
- // printf("[%s] AliasDeclaration::overloadInsert('%s') s = %s %s @ [%s]\n",
455
- // loc.toChars(), toChars(), s.kind(), s.toChars(), s.loc.toChars());
456
-
457
- /* * Aliases aren't overloadable themselves, but if their Aliasee is
458
- * overloadable they are converted to an overloadable Alias (either
459
- * FuncAliasDeclaration or OverDeclaration).
460
- *
461
- * This is done by moving the Aliasee into such an overloadable alias
462
- * which is then used to replace the existing Aliasee. The original
463
- * Alias (_this_) remains a useless shell.
464
- *
465
- * This is a horrible mess. It was probably done to avoid replacing
466
- * existing AST nodes and references, but it needs a major
467
- * simplification b/c it's too complex to maintain.
468
- *
469
- * A simpler approach might be to merge any colliding symbols into a
470
- * simple Overload class (an array) and then later have that resolve
471
- * all collisions.
472
- */
473
- if (semanticRun >= PASS .semanticdone)
474
- {
475
- /* Semantic analysis is already finished, and the aliased entity
476
- * is not overloadable.
477
- */
478
- if (type)
479
- {
480
- /*
481
- If type has been resolved already we could
482
- still be inserting an alias from an import.
483
-
484
- If we are handling an alias then pretend
485
- it was inserting and return true, if not then
486
- false since we didn't even pretend to insert something.
487
- */
488
- return this ._import && this .equals(s);
489
- }
490
-
491
- // https://issues.dlang.org/show_bug.cgi?id=23865
492
- // only insert if the symbol can be part of a set
493
- const s1 = s.toAlias();
494
- const isInsertCandidate = s1.isFuncDeclaration() || s1.isOverDeclaration() || s1.isTemplateDeclaration();
495
-
496
- /* When s is added in member scope by static if, mixin("code") or others,
497
- * aliassym is determined already. See the case in: test/compilable/test61.d
498
- */
499
- auto sa = aliassym.toAlias();
500
-
501
- if (auto td = s.toAlias().isTemplateDeclaration())
502
- s = td.funcroot ? td.funcroot : td;
503
-
504
- if (auto fd = sa.isFuncDeclaration())
505
- {
506
- auto fa = new FuncAliasDeclaration(ident, fd);
507
- fa.visibility = visibility;
508
- fa.parent = parent;
509
- aliassym = fa;
510
- if (isInsertCandidate)
511
- return aliassym.overloadInsert(s);
512
- }
513
- if (auto td = sa.isTemplateDeclaration())
514
- {
515
- auto od = new OverDeclaration(ident, td.funcroot ? td.funcroot : td);
516
- od.visibility = visibility;
517
- od.parent = parent;
518
- aliassym = od;
519
- if (isInsertCandidate)
520
- return aliassym.overloadInsert(s);
521
- }
522
- if (auto od = sa.isOverDeclaration())
523
- {
524
- if (sa.ident != ident || sa.parent != parent)
525
- {
526
- od = new OverDeclaration(ident, od);
527
- od.visibility = visibility;
528
- od.parent = parent;
529
- aliassym = od;
530
- }
531
- if (isInsertCandidate)
532
- return od.overloadInsert(s);
533
- }
534
- if (auto os = sa.isOverloadSet())
535
- {
536
- if (sa.ident != ident || sa.parent != parent)
537
- {
538
- os = new OverloadSet(ident, os);
539
- // TODO: visibility is lost here b/c OverloadSets have no visibility attribute
540
- // Might no be a practical issue, b/c the code below fails to resolve the overload anyhow.
541
- // ----
542
- // module os1;
543
- // import a, b;
544
- // private alias merged = foo; // private alias to overload set of a.foo and b.foo
545
- // ----
546
- // module os2;
547
- // import a, b;
548
- // public alias merged = bar; // public alias to overload set of a.bar and b.bar
549
- // ----
550
- // module bug;
551
- // import os1, os2;
552
- // void test() { merged(123); } // should only look at os2.merged
553
- //
554
- // os.visibility = visibility;
555
- os.parent = parent;
556
- aliassym = os;
557
- }
558
- if (isInsertCandidate)
559
- {
560
- os.push(s);
561
- return true ;
562
- }
563
- }
564
- return false ;
565
- }
566
-
567
- /* Don't know yet what the aliased symbol is, so assume it can
568
- * be overloaded and check later for correctness.
569
- */
570
- if (overnext)
571
- return overnext.overloadInsert(s);
572
- if (s is this )
573
- return true ;
574
- overnext = s;
575
- return true ;
576
- }
577
-
578
452
override const (char )* kind () const
579
453
{
580
454
return " alias" ;
@@ -639,17 +513,6 @@ extern (C++) final class OverDeclaration : Declaration
639
513
return this .aliassym == s;
640
514
}
641
515
642
- override bool overloadInsert (Dsymbol s)
643
- {
644
- // printf("OverDeclaration::overloadInsert('%s') aliassym = %p, overnext = %p\n", s.toChars(), aliassym, overnext);
645
- if (overnext)
646
- return overnext.overloadInsert(s);
647
- if (s == this )
648
- return true ;
649
- overnext = s;
650
- return true ;
651
- }
652
-
653
516
override bool isOverloadable () const
654
517
{
655
518
return true ;
0 commit comments