Commit graph

92 commits

Author SHA1 Message Date
Joshua Warner
61bc0b3464
Resolve TODO around handling non-plain strings 2025-01-11 20:24:34 -08:00
Joshua Warner
e0ef01fa82
Fix two canonicalization crashes: try() and overflowed tuple indexes 2025-01-11 20:24:34 -08:00
Joshua Warner
7d464a2989
add failing test for ignored fields canonicalization 2025-01-11 20:24:33 -08:00
Sam Mohr
2150ee2219
Remove Task from Roc 2025-01-08 17:00:40 -08:00
Anthony Bullard
898b3f55e5
Move PNC apply to separate Expr/Pattern variant 2025-01-08 14:47:49 -06:00
Sam Mohr
cbcbfd3265
Remove backpassing 2025-01-01 17:44:56 -08:00
Joshua Warner
f4698e1517
Fix can panic with unbound type variables 2024-12-28 10:39:05 -05:00
Joshua Warner
cbd6d50584
Give an error instead of panicking on an empty tuple type 2024-12-09 21:24:09 -08:00
Sam Mohr
193c23bac8
Merge pull request #7296 from smores56/proper-try-keyword
Proper `try` keyword
2024-12-05 01:38:22 -08:00
Sam Mohr
eedade8e81
Initial working version of proper try keyword 2024-12-04 02:31:59 -08:00
Anthony Bullard
a2083cec30
Parsing support for snake_case identifiers
In this initial commit, I have done the following:

- Added unit tests to roc_parse's ident.rs file to cover at least the
  simplest Ident enum cases (Tag, OpaqueRef, and simple Access)
- Added '_' as a valid "rest" character in both uppercase and lowercase
  identifier parts
- Updated the test_syntax snapshots appropriately

There is still a lot left to do here. Such as:

- Do we want to allow multiple '_'s to parse successfully?
- Handle qualified access
- Handle accessor functions
- Handle record update functions
- Remove the UnderscoreInMiddle case from BadIdent
- Write unit tests for Malformed Idents

I am not a "Rustacean" by any means, but have been through the Book in
years past.  Any feedback on the way I wrote the tests or any other part
of the implementation would be very appreciated.
2024-12-03 20:50:47 -06:00
Luke Boswell
9e37b93336
remove accidental change from debugging 2024-11-30 08:27:21 +11:00
Luke Boswell
fdaaca8c8b
replace cargo deps with workspace in lower_parms, module, mono, parse, problem, roc_target, serialize, solve, solve_problem, specialize_types, test_* 2024-11-29 11:29:04 +11:00
Luke Boswell
8ad7ecdc10
replace cargo deps with workspace in roc_build 2024-11-29 10:40:20 +11:00
JRI98
a332acd7bf
Remove unused malformed related variants 2024-11-14 10:23:06 +00:00
Agus Zubiaga
ecc5fa57dd
Check record field suffixes in annotations 2024-11-09 02:06:05 -03:00
Agus Zubiaga
bc0cfef128
Restore UNNCESSARY DEFINITION errors for top-level defs
Non-top-level defs are already covered
2024-11-07 18:54:25 -03:00
Agus Zubiaga
c9f001b041
Allow ignored defs with an effectful RHS 2024-11-07 18:54:22 -03:00
Agus Zubiaga
2cce5ad023
Allow unsuffixed statements in parser
Moves the "STATEMENT AFTER EXPRESSION" error from the parser to canonicalization.
We'll later use this to allow this case in effectful functions.
2024-11-07 18:54:14 -03:00
Sam Mohr
6a2ffb2f5a
Implement most of the recent round of PR feedback 2024-10-26 04:17:50 -07:00
Sam Mohr
b3e60f9d3a
Implement return keyword 2024-10-20 08:58:59 -07:00
Sam Mohr
2da08be8ef
Remove old record builder syntax 2024-09-21 04:44:44 -07:00
Anton-4
02cf61f985
Merge pull request #7038 from mulias/expr-dbg
Support `dbg` in expressions
2024-09-02 13:30:32 +02:00
Elias Mulhall
56c5b790a7 Refactor dbg expression parsing to work more like function application
Instead of parsing dbg with an expression block, parse the dbg keyword
with no additional arguments. This way the parser treats dbg just like a
variable in function application. We desugar by pattern matching on
`Apply(Dbg, args, called_via)` nodes. This changes the output of syntax
tests since the initial AST is different, but does not change the output
of can or mono.

Add two new errors for dbg in expression position with either no args or
too many args. This is similar to the error behavior of `crash`.

Continue to parse dbg statements with an expression block, as before.
2024-08-29 15:36:48 -04:00
Sam Mohr
12df3a04de
Merge attempt 2024-08-19 23:34:05 -07:00
Sam Mohr
50f6e11423
Deprecate backpassing to prepare for eventual removal 2024-08-16 22:36:04 -07:00
Agus Zubiaga
762799052e
Merge branch 'main' into typecheck-module-params 2024-08-07 18:55:33 -03:00
Luke Boswell
b489c44b19
Merge remote-tracking branch 'remote/main' into builtin-task 2024-07-19 19:51:50 +10:00
Sam Mohr
fe1b6d71fc
Update from PR comments 2024-07-07 18:33:20 -07:00
Sam Mohr
f415017c90
Implement new builder syntax alongside old one 2024-07-07 03:28:59 -07:00
Agus Zubiaga
0cbb352a89
Move unexpected params warning to solve 2024-07-06 21:36:26 -03:00
Agus Zubiaga
f80cb341a6
Move ScopeModules to can 2024-07-05 21:35:52 -03:00
Agus Zubiaga
922b1c44ef
Report missing params 2024-07-02 11:10:00 -03:00
Agus Zubiaga
bc6a84a215
Report unexpected params 2024-07-02 11:09:59 -03:00
Sam Mohr
700c7ae9aa
Add Task as a built-in module/type 2024-06-25 00:03:56 -07:00
Richard Feldman
8357bd8c91
Revise errors for undeclared type vars in aliases 2024-05-12 21:20:11 -04:00
Agus Zubiaga
7efc7a4a3e
Canonicalize ingested files directly instead of creating AST nodes 2024-04-23 18:55:41 -03:00
Agus Zubiaga
7a53484479
Report an error when import shadows a symbol in scope 2024-04-20 12:38:17 -03:00
Agus Zubiaga
979aff8bf7
Explicit builtin import warning
We will now show a warning if a builtin is imported explicitly,
since this is unncessary.

We will not show the warning if they expose functions from the builtin:

	import Dict exposing [isEmpty]

However, we will show a special warning if they expose types from it:

	import Dict exposing [Dict, isEmpty]
2024-04-20 12:35:46 -03:00
Agus Zubiaga
1f347f6ca1
Fix package module resolution in inline imports
We were still passing `ModuleIds` from `load` to `can`, but now
that imports can appear in any scope, we don't know which package
an unqualified module name belongs to from the top level.

We now pass `PackageModuleIds` instead  and keep a Map of `ModuleName` to
`ModuleId` in `Scope`.

This also allow us to import multiple modules with the same name from different
packages as long as a unique alias is provided.
2024-04-20 12:16:37 -03:00
Agus Zubiaga
842a256907
Implement import aliases
Allows a module to be imported with an alias:

    import JsonDecode as JD

Import aliases must be unique and they cannot have the same name
as an imported module.
2024-04-20 12:07:01 -03:00
Luke Boswell
8b9e08bd76
WIP try simplification 2024-04-14 13:45:05 +10:00
Ayaz Hafiz
703ef6608e
Fix errors 2023-10-25 17:14:49 -05:00
Ayaz Hafiz
9d365a8a57
Support basic diagnostic reporting 2023-10-25 17:14:32 -05:00
Richard Feldman
2da41be29f
Merge remote-tracking branch 'origin/main' into abilities-syntax 2023-08-10 20:36:01 -04:00
Folkert
ef39bad7c6
auto clippy fixes 2023-07-10 18:27:08 +02:00
Bryce Miller
e463ccf4a6
merge main 2023-06-07 20:36:54 -04:00
Ajai Nelson
2e5fef5231
Improve error messages involving ignored variables
Fix #3987
2023-06-06 19:46:15 -04:00
Bryce Miller
17c733ec81
has -> implements in roc_problem::can::Problem 2023-05-20 21:12:26 -04:00
Agustin Zubiaga
d2a57112fd Unapplied record builder error 2023-05-08 20:16:38 -03:00