mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
Estimated hours taken: 12 Branches: main Improve the error checking for mutable declarations. Fix a bug with solver types and sub-modules reported by Peter Hawkins. Workaround a bug with mutable declarations and sub-modules. Currently, the compiler aborts if there is a mutable declaration in the parent module. With this change mutable declarations will not be visible in child modules. XXX This is not correct since they should be visible, but this can be fixed as a separate change. compiler/prog_data.m: Extend the item_origin type with information about what source-to-source transformations are responsible for compiler introduced items. We need this information for error checking mutable declarations. It also provides an additional layer of sanity checking in the parse tree. Add origin fields to the clause and initialise items, since they can both now be introduced by source-to-source transformations. compiler/prog_io.m: compiler/prog_io_dcg.m: compiler/prog_io_typeclass.m: Conform to the above change. compiler/make_hlds_passes.m: Don't issue spurious errors about initialise declarations that were introduced by the transformation for mutable declarations. Abort if invalid initialise declarations were introduced by other compiler passes since this indicates a bug in the compiler. Check if mutable declarations occur in the interface of a module and emit an error if they do. Don't generate initialise items and foreign code from a mutable declaration unless we are in the defining module for the mutable declaration. Don't generate foreign_procs for solver types *unless* we are in the defining module. Doing otherwise breaks the compiler when using solver types and sub-modules. Fix the formatting of an error message concerning initialise decls. s/foreign_code/foreign_proc/ in a spot. compiler/add_solver.m: compiler/mercury_to_mercury.m: compiler/recompilation.check.m: compiler/recompilation.version.m: compiler/add_class.m: compiler/add_pragma.m: compiler/state_var.m: Conform to the above changes. compiler/modules.m: Handle mutable declarations in private interfaces. Clean up some code related to foreign_import_module decls. Conform to the changes in prog_data.m. compiler/prog_util.m: Shift the functions for mutable access predicates and variables to this module. The code that generates interface files also needs to be able to access them. compiler/module_qual.m: Conform to the above changes. Fix a bug where the context in the mq_info structure was not being updated. This caused error messages for mutable declarations that contain undefined types or insts to have the wrong context. compiler/hlds_data.m: Fix a typo. vim/syntax/mercury.vim: Highlight `mutable' and `untrailed' appropriately. tests/hard_coded/sub-modules/Mmakefile: tests/hard_coded/sub-modules/ts.m: tests/hard_coded/sub-modules/ts.tsub.m: tests/hard_coded/sub-modules/ts.exp: Add Peter Hawkin's test case for the bug with solver types and sub-modules. tests/invalid/Mmakefile: tests/invalid/bad_mutable.m: tests/invalid/bad_mutable.err_exp: Add a test for the various sorts of errors that can occur with mutable declarations.
Mercury Syntax Highlighting Under Vim 6.0 1. Create a diretory `~/.vim': $ mkdir ~/.vim 2. Copy everything recursively from this directory into `~/.vim': $ cp -r . ~/.vim IMPORTANT: If you already have a file `~/.vim/after/filetype.vim' then you should copy the files from this directory one by one, except for `after/filetype.vim' which you should append to your own `~/.vim/after/filetype.vim'. 3. Ensure you have the following lines in your `~/.vimrc' file: filetype on filetype plugin on syntax enable 4. If you wish to change the colour scheme used by Vim's syntax highlighting, we suggest you put the necessary commands in `~/.vim/colors/mycolours.vim' and append the following to the above list of commands in your `~/.vimrc': colors mycolours 4. Vim will load `~/.vim/syntax/mercury.vim' and `~/.vim/ftplugin/mercury.vim' automatically when opening a .m or .moo file. The syntax file describes two options you may wish to alter from your `~/.vimrc' file. The ftplugin file defines a number of useful keyboard mappings you may wish to consider.