Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: union member already defined?


Union tags must be unique within a given namespace.

type u1 =
    `A1 int
    `B1 flt64
;;

type u2 =
    `A2 flt64
    `B2 char
;;

 ---- On Sat, 28 Jul 2018 02:21:33 -0700 theos <theosjp@xxxxxxxxx> wrote ---- 
 > hi, 
 >  
 > i started to learn myrddin recently and was going through the tutorial. 
 > i am getting - somewhat unexpected - an "already defined" error for the  
 > below union example. this is with the latest version on linux. 
 >  
 > is this supposed to be this way?  and if so what am i doing wrong? 
 >  
 > % mbld -R u2.myr 
 > u2.myr:2: `a already defined on u2.myr:7 
 > FAIL: 6m u2.myr 
 >  
 > % 6m u2.myr 
 > u2.myr:2: `a already defined on u2.myr:7 
 >  
 > % cat u2.myr 
 > type u1 = union 
 >          `a int 
 >          `b flt 
 > ;; 
 >  
 > type u2 = union 
 >          `a flt 
 >          `b char 
 > ;; 
 >  
 > const main = { 
 >  
 > } 
 >  
 > its error-ing out in stab.c - i've poked a bit around in putucon and  
 > gram.y, but had to confess to myself that i dont really know what i am  
 > looking for/at. 
 >  
 > Breakpoint 3, putucon (st=0x5555557d1070, uc=0x5555557dc460) at stab.c:495 
 > 495                     lfatal(old->loc, "`%s already defined on %s:%d", 
 > (gdb) bt 
 > #0  putucon (st=0x5555557d1070, uc=0x5555557dc460) at stab.c:495 
 > #1  0x0000555555578d30 in installucons (st=0x5555557d1070,  
 > t=0x5555557dc6a0) at gram.y:1252 
 > #2  0x0000555555574484 in yyparse () at gram.y:248 
 > #3  0x0000555555563e3b in main (argc=2, argv=0x7fffffffe728) at main.c:276 
 >  
 > thank you, 
 > theo. 
 >  
 >  
 > 



Follow-Ups:
Re: union member already defined?iriri <iri@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Re: union member already defined?theos <theosjp@xxxxxxxxx>
References:
union member already defined?theos <theosjp@xxxxxxxxx>