Commit Graph

57 Commits

Author SHA1 Message Date
Neil Brown
c8b724d2be Merged the latest set of changes from the trunk into the Polyplate branch
I also added the import list to all the Data.Generics imports in the tests (as I did for the other modules recently)
2009-04-10 20:38:29 +00:00
Neil Brown
ddbec737f2 Got all the tests compiling again after recent changes
For some reason, the usage check tests are now very slow to run (perhaps because of all the operator definitions added to each one?), which needs further investigation.
2009-04-10 19:29:40 +00:00
Neil Brown
9c4b8e8df1 Changed tocktest so you can pass it -v options for use with the automatic tests 2009-02-08 16:33:53 +00:00
Neil Brown
ba66cce89f Moved all the remaining pass information to be with the passes themselves, and adjusted the tests accordingly
All the passes now have their information (name, pre-requisites and post- properties) stored at the point where the pass is declared, which means the pass lists are just a simple list of pass functions.

The main consequence of this change was that the tests had to be changed.  Now, instead of taking a "pass applied to data" item (type: PassM b), they take both the pass (type: Pass) and source data (type: b), and apply them later.  This was the decision that involved the simplest changes to the existing tests (simply unbracketing the application of the pass to the source).  I also had to include a few old-style versions though (testPass', testPassShouldFail') for where the functions were being used to test things that weren't actually passes (mainly StructureOccam).

Fixes #48
2008-06-02 14:31:19 +00:00
Neil Brown
0c443255e6 Changed the expression types to use type unification, and removed the old test
The new behaviour is to check that both sides of a dyadic operator have the same type.  This means that multiplying time by a scalar is no longer possible, but it also means (due to the lack of checks after unification) that multiplying two lists is possible, or concatenating two integers.  This needs to be fixed by adding another pass.
2008-05-18 10:30:25 +00:00
Neil Brown
4586cdd43a Added an export list to RainTypes, and removed some tests for old passes 2008-05-18 09:49:11 +00:00
Neil Brown
bf07c441ae Changed the communication type checking to be part of the type unification framework 2008-05-17 19:47:47 +00:00
Neil Brown
cd0c8d2901 Added assignments to the new type unification system for Rain 2008-05-17 14:23:31 +00:00
Neil Brown
3249381995 Added a Rain test file for the type checker 2008-05-17 13:17:12 +00:00
Neil Brown
63a28d0044 Changed the conditionals type-checking to use type unification rather than the old system 2008-05-17 12:53:05 +00:00
Neil Brown
e09fb2b9ec Added support for numeric literals in the type inference algorithm 2008-05-14 12:01:32 +00:00
Neil Brown
ed9c92878a Added a helper function to RainTypesTest to make the unification tests shorter 2008-05-14 10:09:42 +00:00
Neil Brown
9f1d65f4a0 Added more tests for type unification, fixed some bugs and added cleaner error handling 2008-05-14 09:52:16 +00:00
Neil Brown
e3fa3df623 Added a module for doing type unification, and some very basic tests for it 2008-05-13 23:25:42 +00:00
Neil Brown
89c25e3f6c Added a type-class for retrieving the (AST) type of things
This patch hides all the old typeOfExpression, typeOfName, typeOfVariable, etc, and unifies them into a single type-class with an "astTypeOf" function.  The type-class is currently named Typed, but that can easily be changed (it's only explicitly referred to in the Types module).  The patch is essentially the type-class with a giant find-and-replace on the other modules.
2008-05-17 11:41:52 +00:00
Neil Brown
3daf82d318 Merged Alternative and AlternativeCond into a single Alternative item that always has a pre-condition 2008-04-03 14:52:37 +00:00
Adam Sampson
8f7c8b9fcb Define variables necessary for some of the constant-folding tests. 2008-04-06 13:12:04 +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
Neil Brown
8fe152bf98 Merged the type-checking on time-related statements in Rain into the pass that checks types in communications 2008-03-24 15:15:28 +00:00
Neil Brown
b316a7d3f4 Added some tests for checking that constants can't be assigned to in Rain 2008-03-23 12:14:34 +00:00
Neil Brown
af4a66e2e4 Corrected the spelling of the name of one of the Rain passes 2008-03-20 16:46:45 +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
185f68e96d Adjusted the tests for the annotateListLiteralTypes pass 2008-03-20 16:34:44 +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
c778ff0031 Fixed some unused module import warnings, now that PassM is not build of monad transformers 2008-03-10 17:19:45 +00:00
Neil Brown
9f18b348e8 Corrected all the tests to use the new PassM monad 2008-03-10 17:07:48 +00:00
Neil Brown
6d4f1dd702 Added labels to all the top-level tests that didn't have one 2008-02-28 16:11:01 +00:00
Neil Brown
74f3cb7fc2 Removed the export of "m" in TestUtils, instead moving the definition to each module that uses it (less confusing that way) 2008-02-24 18:55:44 +00:00
Neil Brown
f17ff5071c Added a Warn monad for warnings, and incorporated a WriterT monad into the PassM stack to support the Warn monad, then changed all the rest of the code accordingly, including adding a Warn instance for the GenParser parser that hides it in the state 2008-02-08 13:22:23 +00:00
Neil Brown
acd57d74de Changed the A.Structured type to be parameterised
This patch is actually an amalgam of multiple (already large) patches.  Those patches conflicted (parameterised Structured vs. changes to usage checking and FlowGraph) and encountered a nasty bug in darcs 1 involving exponential time (see http://wiki.darcs.net/DarcsWiki/ConflictsFAQ for more details).  Reasoning that half an hour (of 100% CPU use) was too long to apply patches, I opted to re-record the parameterised Structured changes as this new large patch.  Here are the commit messages originally used for the patches (which, as mentioned, were already large patches):

A gigantic patch switching all the non-test modules over to using parameterised A.Structured
Changed the FlowGraph module again to handle any sort of Structured you want to pass to it (mainly for testing)
A further gigantic patch changing all the tests to work with the new parameterised Structured
Fixed a nasty bug involving functions being named incorrectly inside transformInputCase
Added a hand-written instance of Data for Structured that allows us to use ext1M properly
Fixed a few warnings in the code
2008-02-05 19:40:27 +00:00
Neil Brown
26dd2fa5c4 Renamed the TestUtil and TreeUtil modules to TestUtils and TreeUtils, to be consistent with the Utils module 2007-12-13 19:05:29 +00:00
Neil Brown
4c20f99ac3 Changed some tests to use the new mSeq matching helpers 2007-11-28 14:30:56 +00:00
Neil Brown
1a7d77d9c4 Added more documentation to the tests for the Rain frontend passes 2007-11-12 15:45:07 +00:00
Neil Brown
38c409d378 Added the -fwarn-unused-imports compiler option to warn about unused imports, and then set about pruning and ordering (mostly in my code) the import lists for all the modules 2007-09-27 13:13:46 +00:00
Neil Brown
c38978c123 Rain: added tests for checking types in wait guards 2007-09-26 23:42:16 +00:00
Neil Brown
41ac788601 Rain: added tests for checking the types in wait statements 2007-09-26 23:08:37 +00:00
Neil Brown
5c827fdacb Rain: added testing for correct types in input statements in alts 2007-09-26 22:37:03 +00:00
Neil Brown
4cc0628757 Corrected the name of one of the RainTypesTest tests 2007-09-26 22:24:01 +00:00
Neil Brown
4e635d84ba Rain: added a pass for checking the types in GetTime processes 2007-09-19 11:36:55 +00:00
Neil Brown
5eb149d598 Rain: added type-checker tests for the Time type 2007-09-19 11:23:41 +00:00
Neil Brown
c97d1d00c8 Changed the error type from String to ErrorReport throughout the code
ErrorReport is of type (Maybe Meta, String), thereby adding an optional code position to error messages.

Die has been changed so that die and dieP are now implemented in terms of dieReport (:: ErrorReport -> m a).  This involved changing less code than changing die to be of type ErrorReport -> m a.  All that had to be changed directly was that Die instances now implement dieReport instead of die.

Any bits of code that "caught" errors has been changed so that it handles ErrorReport instead of String.  This ErrorReport is eventually, in Main, passed to dieIO, which will soon be changed to read the file in and provide the context.  Accordingly, MonadIO m has been added as a constraint to dieIO, and dieInternal has been changed to no longer use dieIO (because really we can't add the MonadIO constraint to dieInternal).

Various error messages have been changed.  Notably, all instances of fail in ParseOccam have been changed to use die or, wherever possible, dieP.  A similar thing has been done in EvalConstants and EvalLiterals.
2007-09-18 10:17:38 +00:00
Neil Brown
c61f2ea617 Rain: added checks that types match in input and output statements 2007-09-16 11:46:01 +00:00
Neil Brown
337ad7fd32 Rain: added type-checking tests for if and while conditionals 2007-09-16 09:59:30 +00:00
Neil Brown
5354c99a4e Rain: added a function and tests for checking the types involved in assignments 2007-09-16 09:18:12 +00:00
Neil Brown
3301207a97 Rain: added more type-checkers tests, all of which pass 2007-09-15 21:19:16 +00:00
Neil Brown
15ce5fee06 Rain: added more type-checker tests and made them pass 2007-09-15 21:01:10 +00:00
Neil Brown
eeacaf1de4 Rain: added tests for type-checking monadic integer expressions, and made them pass 2007-09-15 20:30:41 +00:00
Neil Brown
f9c21dc4c7 Rain: fixed a nasty copy-and-paste mistake in RainTypesTest 2007-09-15 18:35:13 +00:00