File tree Expand file tree Collapse file tree 2 files changed +41
-12
lines changed Expand file tree Collapse file tree 2 files changed +41
-12
lines changed Original file line number Diff line number Diff line change @@ -3556,19 +3556,12 @@ public:
3556
3556
}
3557
3557
}
3558
3558
s = s.toAlias();
3559
+
3559
3560
// Same as wthis.ident
3560
- if (s.needThis() || s.isTemplateDeclaration())
3561
- {
3562
- e = new VarExp(loc, withsym.withstate.wthis);
3563
- e = new DotIdExp(loc, e, ident);
3564
- }
3565
- else
3566
- {
3567
- Type t = withsym.withstate.wthis.type;
3568
- if (t.ty == Tpointer)
3569
- t = (cast (TypePointer)t).next;
3570
- e = typeDotIdExp(loc, t, ident);
3571
- }
3561
+ // TODO: DotIdExp.semantic will find 'ident' from 'wthis' again.
3562
+ // The redudancy should be removed.
3563
+ e = new VarExp(loc, withsym.withstate.wthis);
3564
+ e = new DotIdExp(loc, e, ident);
3572
3565
e = e.semantic(sc);
3573
3566
}
3574
3567
else
Original file line number Diff line number Diff line change @@ -467,6 +467,41 @@ void test7()
467
467
static assert (! __traits(compiles, S7 .bar(1 )));
468
468
}
469
469
470
+ /* *******************************************************/
471
+ // 4350
472
+
473
+ template Mix4350 () { int b; }
474
+
475
+ struct S4350
476
+ {
477
+ int a;
478
+
479
+ mixin Mix4350 mix;
480
+
481
+ int c;
482
+ template Func () { void call(int n) { c = n; } }
483
+ alias func = Func! ();
484
+ }
485
+
486
+ void test4350 ()
487
+ {
488
+ S4350 s;
489
+
490
+ s.a = 1 ;
491
+ s.mix.b = 2 ;
492
+ s.func.call(3 );
493
+ assert (s.a == 1 );
494
+ assert (s.b == 2 );
495
+ assert (s.c == 3 );
496
+
497
+ with (s) { a = 2 ; }
498
+ with (s) { mix.b = 3 ; }
499
+ with (s) { func.call(4 ); }
500
+ assert (s.a == 2 );
501
+ assert (s.b == 3 );
502
+ assert (s.c == 4 );
503
+ }
504
+
470
505
/* *******************************************************/
471
506
// 6430
472
507
@@ -604,6 +639,7 @@ int main()
604
639
test5();
605
640
test6();
606
641
test7();
642
+ test4350();
607
643
test9619();
608
644
test9633();
609
645
You can’t perform that action at this time.
0 commit comments