compiler issueshttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues2024-03-04T14:20:22+01:00https://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/6expression in where-block are evaluated multiple times if they have a type si...2024-03-04T14:20:22+01:00Steffen Michelsexpression in where-block are evaluated multiple times if they have a type signatureIn this code `x` is only evaluated once:
```
Start = (x, x)
where
x = trace_n "eval" ()
```
If however the type signature is added, `x` is evaluated twice:
```
Start = (x, x)
where
x :: ()
x = trace_n "eval" ()
```
This i...In this code `x` is only evaluated once:
```
Start = (x, x)
where
x = trace_n "eval" ()
```
If however the type signature is added, `x` is evaluated twice:
```
Start = (x, x)
where
x :: ()
x = trace_n "eval" ()
```
This is a pity, as I prefer adding as many type signatures as possible, so I currently loose performance without a reason.https://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/103Generating bytecode: unknown instruction 'eqR_a' when using pattern-match wit...2024-03-21T10:58:11+01:00Peter AchtenGenerating bytecode: unknown instruction 'eqR_a' when using pattern-match with Real constant valueThe following program compiles (and should), but generating bytecode gives an error:
```
Compiling Example
Optimising Example
Generating bytecode for Example
Unknown instruction 'eqR_a' at line 97.
Generating bytecode failed
```
Minima...The following program compiles (and should), but generating bytecode gives an error:
```
Compiling Example
Optimising Example
Generating bytecode for Example
Unknown instruction 'eqR_a' at line 97.
Generating bytecode failed
```
Minimal program:
```
module Example
:: T = C Real
g :: T -> Bool
g t = case t of
C 0.0 = True
_ = False
Start = g (C 0.0)
```https://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/102undocumented record behaviour2024-03-07T15:35:50+01:00Mart Lubbersundocumented record behaviourThe following code is valid apparently:
```
module test
:: T = {a :: Int, b :: Bool}
Start =
let /*a = 42*/
b = True
in ({T | a, b}, {T | b, a})
a = 42
```
Is this a bug in the compiler or a missing feature in the language re...The following code is valid apparently:
```
module test
:: T = {a :: Int, b :: Bool}
Start =
let /*a = 42*/
b = True
in ({T | a, b}, {T | b, a})
a = 42
```
Is this a bug in the compiler or a missing feature in the language report (section 5.2).John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/101newtypes with higher-kinded type variables give a strange error2024-02-19T18:41:01+01:00Mart Lubbersnewtypes with higher-kinded type variables give a strange errornewtypes with higher-kinded type variables give a strange error.
e.g.:
T.dcl:
```
definition module T
:: T0 m a =: T0 (m a)
```
T.icl:
```
implementation module T
```
When compiling gives the following error:
```
Error [T.dcl,3,T0]: ...newtypes with higher-kinded type variables give a strange error.
e.g.:
T.dcl:
```
definition module T
:: T0 m a =: T0 (m a)
```
T.icl:
```
implementation module T
```
When compiling gives the following error:
```
Error [T.dcl,3,T0]: m attribute variable not allowed
```John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/100Unexpected parse error message when using _createArray2024-03-04T14:43:14+01:00Peter AchtenUnexpected parse error message when using _createArrayHi,
compiling the function definition:
```
import _SystemArray
g = _createArray 42
```
gives the unexpected compiler error message:
```
Parse error [Experiments.icl,42;3,RHS expression]: <expression> expected instead of _createArray
``...Hi,
compiling the function definition:
```
import _SystemArray
g = _createArray 42
```
gives the unexpected compiler error message:
```
Parse error [Experiments.icl,42;3,RHS expression]: <expression> expected instead of _createArray
```
Using:
```
g = createArray 42 ' '
```
gives no problems.
If you're not allowed to use `_createArray`, then a different error message is clearer.
Cheers,
Peterhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/99Types used in class have to be imported in icl2024-03-04T14:46:03+01:00Elroy JumpertzTypes used in class have to be imported in iclWhen defining a class in a dcl that relies on types defined in other modules, it is not sufficient to import the types in the dcl only. They also have to be imported in the icl. I think this is counter-intuitive and might be a bug.
Mini...When defining a class in a dcl that relies on types defined in other modules, it is not sufficient to import the types in the dcl only. They also have to be imported in the icl. I think this is counter-intuitive and might be a bug.
Minimal example:
### `Type.dcl`
```
definition module Type
:: MyType = MyType
```
### `Class.dcl`
```
definition module Class
import Type
class foo a where
bar :: a -> MyType
```
### `Class.icl`
```
implementation module Class
Start = 0
```
Running `clm Class` results in `Error [Class.dcl,6,bar]: MyType undefined`.
Adding `import Type` to `Class.icl` solves the problem. I think this is strange.https://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/98"Overloading could not be solved" due to synonym in context2021-08-11T11:29:09+02:00Camil Staps"Overloading could not be solved" due to synonym in contextThe program below fails to compile with an overloading error:
```clean
module list
import StdEnv
Start = f []
f :: !(l String) -> () | List l String
f [|_:xs] = f xs
```
> Overloading error [list.icl,7,f]: internal overloading of "f...The program below fails to compile with an overloading error:
```clean
module list
import StdEnv
Start = f []
f :: !(l String) -> () | List l String
f [|_:xs] = f xs
```
> Overloading error [list.icl,7,f]: internal overloading of "f" could not be solved for: List a String (context does not occur in function type)
Changing the context to `List l {#Char}` makes the program compile, but I think the above should work as well.John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/97Qualified record field assignments require explicit qualified imports of the ...2024-03-08T14:39:49+01:00Camil StapsQualified record field assignments require explicit qualified imports of the record fieldsWhen you import two modules with overlap in field names you can import them qualified and use `'Module'.field` in record assignments. However, this does not work with `import qualified Module` alone: you need specifically `from Module im...When you import two modules with overlap in field names you can import them qualified and use `'Module'.field` in record assignments. However, this does not work with `import qualified Module` alone: you need specifically `from Module import qualified :: Record {..}`. Is this intentional? I would expect that `import qualified Module` is enough.
For example:
```clean
definition module a
:: T = { x :: Int }
definition module b
:: T = { x :: Int }
module c
import qualified a
import qualified b
from a import qualified :: T{..} // <-- why are these two lines needed?
from b import qualified :: T{..}
Start = {'b'.T | 'b'.x = 5}.'b'.x
```John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/96add source information to ABC files2024-03-26T08:19:12+01:00Steffen Michelsadd source information to ABC filesThis is required for debugging crashes of the ABC interpreter in the browser (see https://gitlab.com/clean-and-itasks/itasks-sdk/-/issues/476). It can be a simple filename + line number tag for each function, so that you can match `e__iT...This is required for debugging crashes of the ABC interpreter in the browser (see https://gitlab.com/clean-and-itasks/itasks-sdk/-/issues/476). It can be a simple filename + line number tag for each function, so that you can match `e__iTasks_PExtensions_PGIS_PLeaflet__n__f75_P10431` to the corresponding line.John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/95make it possible to a type variable introduced in the type specification o...2022-02-04T11:32:07+01:00Steffen Michelsmake it possible to a type variable introduced in the type specification of a surrounding function in the specification for local functionsThis is not possible (see "3.7 Typing Functions" of the language report). The example given is:
```
f:: a -> (a,a)
f x = g x
where
// g:: b -> (a^,b)
g y = (x,y)
```
This feature would be highly desirable to:
* improve readabi...This is not possible (see "3.7 Typing Functions" of the language report). The example given is:
```
f:: a -> (a,a)
f x = g x
where
// g:: b -> (a^,b)
g y = (x,y)
```
This feature would be highly desirable to:
* improve readability of the code
* improve performance (e.g. the tuple returned by `g` in the example above cannot be made strict without type annotation)John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/94identifiers of ?None constructors still contain "Nothing"2021-04-23T16:54:39+02:00Steffen Michelsidentifiers of ?None constructors still contain "Nothing"The identifiers are still e.g. "_!Nothing". Wouldn't "_?None" be more consistent with the actual syntax?The identifiers are still e.g. "_!Nothing". Wouldn't "_?None" be more consistent with the actual syntax?John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/93Compiler ignores `-o` option2021-04-10T11:15:21+02:00Erin van der VeenCompiler ignores `-o` optionThe `-o` option for the compiler is parsed but never used. This makes it impossible to specify where the `.abc` files should go, in turn making it impossible to use the compiler in the usual way on a system where `$CLEAN_HOME` is read-on...The `-o` option for the compiler is parsed but never used. This makes it impossible to specify where the `.abc` files should go, in turn making it impossible to use the compiler in the usual way on a system where `$CLEAN_HOME` is read-only.
This was noted on the `itask` branch of the compiler. Not checked for `master`.John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/92Compiler crashes when "let let" is parsed2021-03-22T14:48:58+01:00Mart LubbersCompiler crashes when "let let" is parsed```
module test
Start = let let
```
results in:
```
$ clm test
Compiling test
tokenBack with empty token bufferclm: reading compiler result failed: No such file or directory
``````
module test
Start = let let
```
results in:
```
$ clm test
Compiling test
tokenBack with empty token bufferclm: reading compiler result failed: No such file or directory
```John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/91compiler complains about overlapping instances when one is clearly more specific2021-03-15T21:32:17+01:00Steffen Michelscompiler complains about overlapping instances when one is clearly more specific```
class C a :: a
:: T a = A
instance C (a b) where
C = undef
instance C (T b) where
C = undef
```
The instance for `T b` is clearly more specific than the one for `a b`. So this should compile in my opinion.```
class C a :: a
:: T a = A
instance C (a b) where
C = undef
instance C (T b) where
C = undef
```
The instance for `T b` is clearly more specific than the one for `a b`. So this should compile in my opinion.John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/90SegFault when compiling tiny program2021-03-22T17:42:52+01:00Erin van der VeenSegFault when compiling tiny programThe following program causes the compiler to SegFault:
```Clean
Start | False = 1
```
with
``cocl -P . test``The following program causes the compiler to SegFault:
```Clean
Start | False = 1
```
with
``cocl -P . test``John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/89Constants in node patterns2021-02-23T16:11:18+01:00Camil StapsConstants in node patternsWhat is the purpose of the `constant not allowed in a node pattern` error in checkFunctionBodies?
It prevents you from writing things like:
```clean
Start
# [] = [1]
= 1
```
This is useful. Without the error you might think th...What is the purpose of the `constant not allowed in a node pattern` error in checkFunctionBodies?
It prevents you from writing things like:
```clean
Start
# [] = [1]
= 1
```
This is useful. Without the error you might think that the program will check that the pattern matches. However, we *are* allowed to write the following, and there you would then also want an error:
```clean
Start
# [_:_] = []
= 1
```
So this can't be it, or it would be more useful to check whether any variables are bound instead of whether the pattern has arity 0.
Or is the problem that the pattern match would never be performed? But then should this not be a warning instead of an error (and also appear for patterns that do not bind any variables)?John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/88iTasks compile can't solve overloading when using StdOverloadedList.Diag22021-02-25T22:03:13+01:00Steffen MichelsiTasks compile can't solve overloading when using StdOverloadedList.Diag2In this program the type of the arguments and result should be defined unambiguously:
```
import StdOverloadedList
Start :: [(Int, Int)]
Start = Diag2 [1] [2]
```
Still the compiler reports:
```
Overloading error [StdOverloadedList.d...In this program the type of the arguments and result should be defined unambiguously:
```
import StdOverloadedList
Start :: [(Int, Int)]
Start = Diag2 [1] [2]
```
Still the compiler reports:
```
Overloading error [StdOverloadedList.dcl,396,diag2_]: internal overloading of "_nil" could not be solved for: List _ a (contains type variable not in function type at _ )
```John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/87Segmentation fault when comparing unboxed maybes2020-12-15T13:42:08+01:00Camil StapsSegmentation fault when comparing unboxed maybesThe following program crashes with a segmentation fault with the current nightly master compiler on x64 linux:
```clean
import StdEnv, StdMaybe
Start = ?#Just 1 == ?#Just 1
```The following program crashes with a segmentation fault with the current nightly master compiler on x64 linux:
```clean
import StdEnv, StdMaybe
Start = ?#Just 1 == ?#Just 1
```John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/86convertTypeCode lacks alternative for PD_UnboxedMaybeTypeIndex2020-12-11T17:31:53+01:00Camil StapsconvertTypeCode lacks alternative for PD_UnboxedMaybeTypeIndexIn `convertTypeCode` (convertDynamics.icl), the local function `typeConstructor` seems to be missing an alternative for `PD_UnboxedMaybeTypeIndex`, causing a run-time error when packing a `?#` in a dynamic.In `convertTypeCode` (convertDynamics.icl), the local function `typeConstructor` seems to be missing an alternative for `PD_UnboxedMaybeTypeIndex`, causing a run-time error when packing a `?#` in a dynamic.John van GroningenJohn van Groningenhttps://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/85Unsigned integer constants2020-12-07T21:22:50+01:00Camil StapsUnsigned integer constantsI encountered an issue where:
- 32-bit ABC code is interpreted on a 64-bit platform (e.g. compile with 32-bit Clean, run in WebAssembly)
- The code uses negative integer constants with unsigned semantics (e.g. `bitor 0x80000000`)
When ...I encountered an issue where:
- 32-bit ABC code is interpreted on a 64-bit platform (e.g. compile with 32-bit Clean, run in WebAssembly)
- The code uses negative integer constants with unsigned semantics (e.g. `bitor 0x80000000`)
When generating 64-bit bytecode this value is sign-extended, since there is no way to tell that this value should be `0x0000000080000000` on 64-bit platforms.
The issue could be solved by computing the values at runtime (https://gitlab.science.ru.nl/clean-and-itasks/clean-platform/-/merge_requests/386) using only positive values. Performance-wise this is not ideal.
Would it be very difficult to add syntax for unsigned integer constants, e.g. `0x80000000u` or `0ux80000000` (neither of these is fully backwards compatible) all the way down to the ABC level so that the bytecode generator knows how the value should be extended? Or do you see another way to solve this without losing performance?John van GroningenJohn van Groningen