hughperman / pure-lang

Automatically exported from code.google.com/p/pure-lang
0 stars 0 forks source link

type e = e crashes #75

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
> namespace foo;
> type e x::int = 1;
> namespace bar;
> using namespace foo;
> type e = e;
Assertion failed: (qual.empty()), function checkfuns, file interpreter.cc, line 
6420.
Abort trap: 6 (core dumped)

What is the expected output?
Expect bar::e to alias foo::e. Or, to give an error. Or, to spin indefinitely. 
Not to crash. Though arguably crashing may be better than spinning indefinitely.

What version of the product are you using? On what operating system?
Pure 0.5.3 on FreeBSD.

Original issue reported on code.google.com by dubious...@gmail.com on 14 Jun 2012 at 2:58

GoogleCodeExporter commented 8 years ago
Here's some related behavior.

> namespace space0 with type t = int; end;
> namespace space1 with type t v = typep space0::t v; using namespace space0; k 
x = 0; end; // works fine, but..
> namespace space2 with using namespace space0; type t v = typep ::space0::t v; 
k x = 0; end; // crashes
Assertion failed: (qual.empty()), function checkfuns, file interpreter.cc, line 
6420.
Abort trap: 6 (core dumped)

Same result if in the last line one uses space0::t instead of ::space0::t. The 
typename being defined does need to match the (unqualified version of) of the 
typename being referenced. Notice there's no crash when defining namespace1, 
though.

Original comment by dubious...@gmail.com on 14 Jun 2012 at 5:07

GoogleCodeExporter commented 8 years ago
Yep, that's a bug, still the same in 0.55. Thanks for reporting, I'll have a 
look at it asap.

Original comment by aggraef@gmail.com on 14 Jun 2012 at 5:34

GoogleCodeExporter commented 8 years ago
This issue was closed by revision ae4f2f2e9f4b.

Original comment by aggraef@gmail.com on 15 Jun 2012 at 1:17

GoogleCodeExporter commented 8 years ago
That assertion was simply bogus. According to the namespacing rules, both 
instances of the symbol e in the last line of your example should be promoted 
to the bar namespace, because foo is being defined there.

Original comment by aggraef@gmail.com on 15 Jun 2012 at 1:22

GoogleCodeExporter commented 8 years ago
Thanks for the speedy fixes.

Original comment by dubious...@gmail.com on 15 Jun 2012 at 9:49

GoogleCodeExporter commented 8 years ago
As you've seen, impossible things take a bit longer. :) Thanks a lot for the 
nice bug reports, that makes my job much easier.

Original comment by aggraef@gmail.com on 15 Jun 2012 at 3:34