Adam Sampson
bfd7b079a7
Make unsubscriptType handle Infer.
2008-04-06 18:42:40 +00:00
Adam Sampson
3ab0c30589
When rendering array literals, recompute the dimensions.
...
This makes sure that literals produced by the constant evaluator will never
contain UnknownDimension. The change looks a lot more complex than it really
is; it already carried the type "downwards", and most of this is just making it
carry it back up to where the A.Literal is being constructured.
2008-04-06 15:40:50 +00:00
Adam Sampson
1640b9ce63
Move applyDimension into Types.
2008-04-06 15:32:35 +00:00
Adam Sampson
b65512b64c
Make getConstantName descend into definitions.
...
This means you don't have to have folded constants throughout the tree/state in
order to evaluate them, which makes the early passes less awkward to manage.
2008-04-06 13:46:48 +00:00
Adam Sampson
1977e7880b
Move evalIntExpression into EvalConstants, now that Types doesn't need it.
...
It now uses the full expression evaluator rather than the literal-only version.
2008-04-06 13:31:37 +00:00
Adam Sampson
9838cf7b8c
Use forall to remove some repeated monad constraints.
2008-04-06 11:19:43 +00:00
Adam Sampson
aa3b17b555
Make protocolItems give a more useful error message on failure.
2008-04-06 02:50:46 +00:00
Adam Sampson
e1fca531a0
Rework how OccValue is rendered to an Expression.
...
The rendering code now takes the type it's aiming for, so it can produce a
value of exactly the same type as the expression that was being folded
originally (rather than trying to work it out for itself).
2008-04-06 02:29:02 +00:00
Adam Sampson
2fdf749be0
Handle Infer in evalSimpleLiteral.
2008-04-06 02:28:43 +00:00
Adam Sampson
71df38813f
Make subscriptType and trivialSubscriptType aware of Infer.
...
Subscripting Infer gives you Infer.
This also makes trivialSubscriptType handle user types in the same way as
subscriptType. (There probably isn't much reason to have both any more, since
subscriptType doesn't do the checks it used to do.)
2008-04-06 02:27:07 +00:00
Adam Sampson
e9d95aa0fd
Tidy up OccValue a bit.
2008-04-06 00:48:02 +00:00
Adam Sampson
37b5735de1
When showing occam code, use CHAN/PORT rather than CHAN OF/PORT OF.
2008-04-05 23:19:12 +00:00
Adam Sampson
e52b51b050
Add an Infer type to mark types that should be inferred.
...
We can then check it's been removed using a property later.
2008-04-04 12:09:33 +00:00
Neil Brown
4ef1ff7196
Changed to a state monad for warnings, and added a runPassM function to remove duplicate code for running passes
2008-04-03 12:21:59 +00:00
Neil Brown
20843f70a4
Corrected all the tests to use the new PassM monad
2008-03-10 17:07:48 +00:00
Neil Brown
d66fb79796
Fixed some unused module import warnings, now that PassM is not build of monad transformers
2008-03-10 17:19:45 +00:00
Adam Sampson
bd9c4dae98
Go back to passing the value to the type-contains function.
...
This'll make the modification to look at constructors cleaner.
2008-04-02 16:11:13 +00:00
Adam Sampson
f515b5ce55
Change "find" to "targets", for clarity.
2008-04-02 15:16:47 +00:00
Adam Sampson
d9df114909
Rework gmapMFor so it takes a list of type keys.
...
This means we only need one gmapMFor function, and we do fewer calls to
typeKey, but we have to make typeKey available for use where it's called.
2008-04-02 15:09:07 +00:00
Adam Sampson
aeb2ebd9f4
Fix Haddock.
2008-04-01 13:22:30 +00:00
Adam Sampson
d2bcd0cde5
Use IntMap.keysSet.
...
(Thanks to Neil for spotting this!)
2008-03-26 23:19:37 +00:00
Adam Sampson
3283b7db41
Remove the Type/AbbrevMode information from Actual*.
...
It's redundant, since you can always compute them from the variable, and it
makes the code that deals with actuals rather cleaner.
On the other hand, it slightly complicates some of the tests, because any names
you use in an Actual need to be defined...
2008-03-26 18:16:09 +00:00
Adam Sampson
ef329e3ed0
Check SpecTypes.
2008-03-26 14:20:35 +00:00
Adam Sampson
c9cb7d2bf9
Check Proc calls.
2008-03-26 12:26:04 +00:00
Adam Sampson
6861b22da6
Check timer operations.
2008-03-25 16:45:25 +00:00
Adam Sampson
b3e3308b3e
Implement channel IO checks, and refactor OccamTypes (again).
2008-03-25 15:56:03 +00:00
Neil Brown
c68aa42277
Added a sub-type to Timers, to support multiple types
2008-03-23 22:20:16 +00:00
Neil Brown
7830d82c51
Fixed the display of names in ShowCode for Rain
2008-03-23 12:13:55 +00:00
Neil Brown
1bf3f6f0f1
Fixed the type of a function name in buildExpr to fix the tests
2008-03-23 12:08:08 +00:00
Neil Brown
6f76f6385e
Added to an error message in Types to help determine the problem
2008-03-23 00:07:48 +00:00
Neil Brown
e767e33190
Added support for some intrinsic (time-related) functions in Rain
2008-03-22 18:58:10 +00:00
Neil Brown
7f28d3dbe3
Added a warnPC function (like diePC) for use with formatCode
2008-03-22 18:34:40 +00:00
Neil Brown
710abd7019
Added support for function calls to the Rain parser
2008-03-22 17:49:21 +00:00
Adam Sampson
60ca26128c
More occam typechecks: input/output items, replicators, choices.
...
Various infrastructure too to support these.
Doing A.ForEach raised an interesting question: what does it work over? In
plain occam it'd just be arrays, but it should obviously work for lists too.
This suggests that Size and Subscript should work on lists as well, since
ForEach will be implemented in terms of them. I've therefore introduced the
idea of a "sequence" class of types.
2008-03-22 23:47:29 +00:00
Adam Sampson
388f2f38a6
plainSubscriptType doesn't really need to know what the subscript is.
2008-03-22 00:53:46 +00:00
Adam Sampson
56de093739
Add isScalarType.
2008-03-22 00:53:13 +00:00
Adam Sampson
8b2568264d
Add more utility functions along the lines of defineConst.
...
These let you define various sorts of name in the initial state of a pass test.
2008-03-22 00:44:57 +00:00
Adam Sampson
8b5233ba47
Add ShowCode instances for A.Name.
2008-03-22 00:42:00 +00:00
Adam Sampson
cfc5b18e3e
Don't show the state when a pass unexpectedly succeeds.
...
This used not to be a problem, but there's now quite a lot of stuff predefined
in the state when testing the typechecker, so it tends to obscure the real
error...
2008-03-20 23:56:13 +00:00
Neil Brown
025eebf61d
Added support for giving ranges an explicit type in Rain
2008-03-21 21:10:47 +00:00
Neil Brown
2189a6c28a
Added support for list literals to the Rain parser
2008-03-21 20:03:47 +00:00
Neil Brown
33b04e7646
Tidied up a few unused functions and module imports
2008-03-21 15:16:36 +00:00
Neil Brown
0e3465afc0
Corrected some Rain tests to avoid using the Int type
2008-03-20 16:42:25 +00:00
Neil Brown
a6452f93df
Added a ShowOccam and ShowRain instance for lists of things
2008-03-20 16:34:11 +00:00
Neil Brown
ecb82d13a8
Revamped the ShowCode module, transforming it to use the writer monad
2008-03-20 16:20:14 +00:00
Neil Brown
bd26f758b4
Added tests for annotating the types of list literals and ranges in Rain
2008-03-20 14:44:19 +00:00
Neil Brown
123936e71c
Changed addOne to use Add not Plus (we can always define a plusOne...)
2008-03-20 12:30:07 +00:00
Neil Brown
713b5c3e5c
Added a subExprs helper function to match the rest
2008-03-19 17:52:01 +00:00
Neil Brown
b496912c51
Fixed conflicts with Adam's dimension changes
2008-03-19 17:49:32 +00:00
Neil Brown
35ebd43f79
Fixed some error messages in the Types module
2008-03-19 17:02:45 +00:00