orc-lang / orc

Orc programming language implementation
https://orc.csres.utexas.edu/
BSD 3-Clause "New" or "Revised" License
40 stars 3 forks source link

A simple type definition causes crash in type checker #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Procedure to Repeat:
Attempt to type check the following:

type Time = Integer
type Range = Range(Time, Time) -- <-- Error is here

signal

Version and Platform:
SVN r3159

Reporter's Comments:
It appears the problem is in the type checking of the site definition the type 
Range is desugared into. The important bit may be this:

type Time = Integer
type Range = [](Range(Time,Time))
(signal <`t1< ((Datatype[Range](`t2) <`t2< Tuple("Range", 2)) >`t3> `t3))

I have a suspicion someone more familiar with the type checker and desugaring 
could fix this much easier than I could, but I will give in a shot in a few 
days if no one can fix is easily. But hints would be appreciated.

Original issue reported on code.google.com by arthur.peters on 26 Jan 2013 at 4:33

GoogleCodeExporter commented 9 years ago
I think I see the problem. The type checker is creating a tuple internally to 
hold the constructors of a variant type. If there is only a single variant, the 
tuple will have size 1, which is disallowed by an assertion in TupleType, as a 
sanity check. Maybe this should be changed to a record? 

Original comment by dkitc...@gmail.com on 28 Jan 2013 at 3:53

GoogleCodeExporter commented 9 years ago
A record makes sense since the constructors are actually named. Should I try to 
implement this? Or should I assign the bug to you?

Original comment by arthur.peters on 28 Jan 2013 at 4:49

GoogleCodeExporter commented 9 years ago
Fixed in r3171. Please reopen is there are problems with the fix.

Original comment by arthur.peters on 30 Jan 2013 at 11:18

GoogleCodeExporter commented 9 years ago

Original comment by arthur.peters on 30 Jan 2013 at 11:18