# compiler
This is the repository of the [Clean][] compiler.
This is a delayed mirror of the [upstream][] version and is only used to
publish the package. Periodically changes from upstream are released in a new
version here.
See the documentation in [base][] and the notes on
[updating](/CONTRIBUTING.md#updating) if you intend to make a merge request for
this repository.
## Packages
In this repository the sources of three packages are kept:
- [`base-compiler`][base-compiler], which contains the compiler executable.
This package should not be included directly, but through [`base`][base].
- [`lib-compiler`][lib-compiler]. This is a library with which you can use
modules from the Clean compiler.
The versions of these packages are kept in sync. This means that `lib-compiler`
patch versions may not be backwards compatible. Normally you will want to use
this dependency with an exact version constraint, e.g. `=1.0.0`.
`base-compiler-itasks` and `lib-compiler-itasks` are old packages with a
special version of the compiler with extensions for iTasks. All extensions were
merged into `base-compiler` in June 2022.
See [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on updating this
repository.
## Using the library
The Clean frontend of the compiler in `lib-compiler` can be used as any other
library.
On Windows systems, if an application uses not only the compiler frontend but
also the backend, it should copy `misc/dll/backend.dll` to the directory of the
executable.
On Unix systems, object code from the C backend is linked automatically if
needed.
## Maintainer & license
This project is maintained by [Camil Staps][].
The upstream is maintained by John van Groningen.
For license details, see the [LICENSE](/LICENSE) file.
[base]: https://clean-lang.org/pkg/base/
[base-compiler]: https://clean-lang.org/pkg/base-compiler/
[Camil Staps]: https://camilstaps.nl
[Clean]: https://clean-lang.org/
[itasks]: https://gitlab.com/clean-and-itasks/base/compiler/-/tree/itasks
[lib-compiler]: https://clean-lang.org/pkg/lib-compiler/
[main]: https://gitlab.com/clean-and-itasks/base/compiler/-/tree/main
[upstream]: https://gitlab.com/clean-compiler-and-rts/compiler
# Changelog
#### v3.1.1
- Fix: fix type checking of updates of arrays of unique coercible elements.
- Fix: reject `case` expressions without alternatives in parser.
- Fix: fix sign classification of type parameters after the first of type
definitions.
- Misc: delay expanding newtypes in the type checker.
### v3.1.0
- Enhancement: allow patterns after qualified constructors in `=:` expressions
without parentheses (e.g. `a=:'M'.C 0`); already allowed for constructors in
the global namespace.
- Enhancement: optimize calls to generic functions with an implementation
exported in a definition module by creating a local copy (except for generic
representation types, e.g. `PAIR`).
- Enhancement: add unfolding of functions yielding a character, integer or real
constant in (trivial) fusion.
- Fix: fix bug in generic fusion for active trivial boolean cases on a case
path with a function argument.
- Fix: report an error for tuples with more than 32 elements.
- Fix: improve checking of required imports of module StdStrictLists.
- Fix: prevent compiler crash when compiling macros such as `.` imported from a
definition module.
- Fix: disallow unique attributes that propagate to the root in CAF types.
- Fix: fix parsing of qualified non-alphanumeric identifiers with a module name
of length 1 (e.g. `'L'. ++`).
- Fix: fix parsing of record patterns without definitions; don't allow
definitions.
- Fix: fix compiler crash for match functions generated for irrefutable unboxed
list patterns when the elements are not in a strict context.
- Fix: fix reporting of uniqueness type coercion errors.
#### v3.0.3
- Fix: substitute type variables and attributes when expanding a newtype with a
universal quantifier.
- Fix: fix replacement of an explicit case by a case alternative with a strict
let.
- Fix: fix bug that prevented unboxing arguments of some closures.
#### v3.0.2
- Enhancement: add optimisation to generic fusion to prevent generating some
small functions with many arguments that may cause fusion to stop because of
the 32 arguments limit. Instead generate larger functions with fewer
arguments by inlining function calls.
- Enhancement: speed up and reduce memory usage of compilation with generic
fusion. Instead of generating a new trivial function and inlining the
function later do this immediately (without generating a new function) in
some cases.
- Fix: the Windows version of `lib-compiler` now distributes `backend.dll` in
`misc/dll/backend.dll` instead of `exe/backend.dll` to avoid a name clash
with `base-compiler`.
#### v3.0.1
- Fix: prevent compiler crash when explicitly importing a macro using a new
type pattern match.
## v3.0
- Feature: add `{ :}`, `{! :}`, `{# :}`, and `{32# :}` array types which
reserve up to the next power of 2 of memory. This uses the ABC instructions
`create_arrayp2` and `create_arrayp2_`.
- Feature: add functional dependencies (backported from the iTasks compiler).
- Feature: add `import qualified .. as ..` (backported from the iTasks
compiler).
- Feature: add `binumap` (backported from the iTasks compiler).
- Fix: fix printing of higher-order array types.
- Fix: prevent stack overflow when compiling very large function types.
#### v2.0.1
- Chore: allow `base-stdenv` ^2.0.
## v2.0
- Enhancement: use ABC instructions `select_nc` and `update_nc` for array
updates and selects when indexes do not need to be checked (e.g. in array
comprehensions).
- Enhancement: add names of comprehensions to generated identifiers in
patterns.
- Fix: bug in generic fusion causing incorrect functions to be generated.
## v1.0
First tagged version.