469 Commits

Author SHA1 Message Date
Gaith Hallak
94c8bc3671 Make interfaces declare functions from extended interfaces 2022-05-25 19:38:10 +04:00
Gaith Hallak
5624279d6d Rename check_implemented_interfaces_recursive to check_implemented_interfaces1 2022-05-25 19:38:10 +04:00
Gaith Hallak
f92e995931 Remove arrows_in_type and use infer_type_vars_variance instead 2022-05-25 19:38:10 +04:00
Gaith Hallak
2883b41beb Test only for covariance and contravariance 2022-05-25 19:38:10 +04:00
Gaith Hallak
96d9509b44 Compare named args in fun_t 2022-05-25 19:38:10 +04:00
Gaith Hallak
78d2ce2e75 Use is_list to check if a var is a list 2022-05-25 19:38:10 +04:00
Gaith Hallak
822d54709e Fixes from the reviews 2022-05-25 19:38:10 +04:00
Gaith Hallak
94c2f998ae Don't destroy and recreate type errors table when not needed 2022-05-25 19:38:10 +04:00
Gaith Hallak
8a9c2a61b2 Add type_vars_uvar ets table to ets_tables() 2022-05-25 19:38:10 +04:00
Gaith Hallak
8e888430d9 Mark tvars as invariant 2022-05-25 19:38:10 +04:00
Gaith Hallak
1980eb30bf Fix warning 2022-05-25 19:38:10 +04:00
Gaith Hallak
ae9b8f8b16 Make is_subtype/4 a separate function 2022-05-25 19:38:10 +04:00
Gaith Hallak
b9af3dbe7f Make opposite_variance a separate function 2022-05-25 19:38:10 +04:00
Gaith Hallak
918346445f Add testing for custom types variance switching 2022-05-25 19:38:10 +04:00
Gaith Hallak
dd259fbc96 Fix dialyzer warning 2022-05-25 19:38:10 +04:00
Gaith Hallak
44bd16264a Variance switching for custom datatypes 2022-05-25 19:38:10 +04:00
Gaith Hallak
3a00476f88 Fix tests after rebase 2022-05-25 19:38:10 +04:00
Gaith Hallak
01fb058def Add variance switching 2022-05-25 19:38:10 +04:00
Gaith Hallak
a068822278 Revert "Draft: Add variance switching"
This reverts commit 92dc6ac169cfbff447ed59de04994f564876b3fb.
2022-05-25 19:38:10 +04:00
Gaith Hallak
b1b7f6cf6d Draft: Add variance switching 2022-05-25 19:38:10 +04:00
Gaith Hallak
df676ff6e9 Report undefined interface errors before checking implemented interfaces 2022-05-25 19:38:10 +04:00
Gaith Hallak
03413ab0d4 Fix the comparison between unit and empty tuple 2022-05-25 19:38:10 +04:00
Gaith Hallak
d8db908485 Add new tests and fix old tests 2022-05-25 19:38:10 +04:00
Gaith Hallak
6003aacdea Fix pretty printing 2022-05-25 19:38:10 +04:00
Gaith Hallak
4c25489963 Add polymorphism to infer types 2022-05-25 19:38:09 +04:00
Gaith Hallak
212534976a Add polymorphism to syntax tree and parser 2022-05-25 19:32:47 +04:00
Gaith Hallak
b0e6418161
Ban empty record definitions (#384)
* Ban empty record declarations

* Use definition instead of declaration

* Fix the failing test
2022-05-25 17:59:46 +04:00
Gaith Hallak
a894876f56
Show the file name in the location if the file is included (#383) 2022-05-10 18:27:06 +04:00
Radosław Rowicki
0af45dfd19
Deprecate AEVM (#375)
* Deprecate AEVM

* Fix test, changelog

* Restore old rebar

* rebar lock fix

* undo export

Co-authored-by: Gaith Hallak <gaithhallak@gmail.com>

* undo export

Co-authored-by: Gaith Hallak <gaithhallak@gmail.com>

* Solve GH suggestions

* Fix the docs

* update docs

* Remove unused tests

* undo weird change

Co-authored-by: Gaith Hallak <gaithhallak@gmail.com>
2022-05-10 15:33:59 +02:00
Gaith Hallak
c5bfcd3bdc
Add MCL_BLS12_381 types to from_fate_builtin (#382)
* Add MCL_BLS12_381 types to from_fate_builtin

* Add tests for mcl_bls12_381 types to sophia value
2022-05-05 13:19:43 +04:00
Gaith Hallak
74aff5401b
Introduce pipe operator |> (#371)
* Add pipe operator

* Add tests

* Update docs and CHANGELOG
2022-04-12 12:40:32 +03:00
Hans Svensson
c1c3c29393
Add oneline error pretty-printing (#364) 2022-01-11 14:02:05 +01:00
Gaith Hallak
b474bb22cd
Implement caching for compiled child contracts (#363) 2022-01-11 16:50:59 +04:00
Gaith Hallak
37d86ad45b Simplify error messages reported by the compiler
Add raw error message for 2 errors

The errors: `unnamed_map_update_with_default` and `unbound_variable`.

Revert "Add raw error message for 2 errors"

This reverts commit 0db6d16140d52e29cd8a12d8719ee57ca874d5f5.

Remove trailing new lines and at POS from error messages

Convert multiple line error messages into single line error messages

Remove at POS from pp_why_record context

Change error message with new line before code

Fix tests for changed error messages

Fix the rest of the error messages

Add new line after error message

Remove new line from the end of data error messages
2022-01-11 11:48:08 +04:00
Gaith Hallak
60f3a484e6
Solve constraints together and in the order they are added (#360)
* Solve named argument constraints when record type dereferencing fails

* Revert "Solve named argument constraints when record type dereferencing fails"

This reverts commit ca38a171a9eefdddbc3f6a41f8a268c42662cd7a.

* Solve constraints together and in order

* Fix dialyzer warnings

* Add comment on solve_known_record_types

* Remove unused function
2021-12-16 13:54:06 +02:00
Gaith Hallak
fe5f5545d3
Add compiler warnings (#346)
* Add compiler warnings

Add include_type annotation to position

Add warning for unused includes

Add warning for unused stateful annotation

Add warning for unused functions

Add warning for shadowed variables

Add division by zero warning

Add warning for negative spends

Add warning for unused variables

Add warning for unused parameters

Change the ets table type to set for unused vars

Add warning for unused type defs

Move unused variables warning to the top level

Temporarily disable unused functions warnings

Add all kinds of warnings to a single ets table

Enable warnings separately through options

Use when_option instead of enabled_warnings

Turn warnings into type errors with warn_error option

Enable warning package warn_all

Re-enable unused functions warnings

Report warnings as type errors in a separate function

Make unused_function a recognized warning

Report warnings as a result of compilation

Fix tests and error for unknown warnings options

Fix dialyzer warnings

Do not show warning for variables called "_"

Move warnings handling into a separate module

Do not show warning for unused public functions in namespaces

Add src file name to unused include warning

Mark public functions in namespaces as used

Add tests for added warnings

Add warning for unused return value

Add test for turning warnings into type errors

* Update CHANGELOG
2021-11-24 11:46:21 +02:00
Gaith Hallak
5ad5270e38
Bump version to 6.1.0 and fix CHANGELOG (#348) 2021-10-20 12:42:48 +03:00
Gaith Hallak
a982f25262
Pattern guards for functions and switch statements (#339)
* Add case guards to parser

* Add pattern guards to infer types and fcode generation

* Add functions guards

* Add test for patterns guards

* Update docs

* Update CHANGELOG.md

* Remove stateful context from Env for guards

* Elaborate on guards

* Add failing test for stateful pattern guards

* Implement multiple guards

* Fix tests

* Disable aevm related tests

* Split the sentence before if and otherwise

* Fix type in docs

* Implement multiple exprs in the same guard

* Fix pretty printing

* Change tests to include multiple guards

* Add test for non-boolean guards

* Desugar clauses with guards

* Fix incomplete patterns bug

* Fix docs

* Compile to icode when no guards are used

* Revert "Disable aevm related tests"

This reverts commit e828099bd97dffe11438f2e48f3a92ce3641e85b.
2021-10-20 11:04:00 +03:00
Hans Svensson
6d79d2d558
GH344 - Add builtin types in decoder (#345)
* Only use basic types in type_env

* Add builtin types to the calldata/result decoder for FATE
2021-09-30 19:11:00 +02:00
Hans Svensson
1be24c94c5 Don't forget stateful when rendering the ACI 2021-09-20 14:50:16 +02:00
Gaith Hallak
e8a171dc45
Allow assigning patterns to variables (#336)
* Change syntax tree and parser

* Add assign pattern to type inference

* Use check_expr instead of hard-coded type

* Add fcode generation for assign pattern

* Implement rename_spat for assign pattern

* Add tests

* Update CHANGELOG.md

* Update docs and changelog

* Add letpat to aeso_syntax_utils:fold

* Use Plus instead of Scoped
2021-09-11 16:18:30 +02:00
Gaith Hallak
a7b7aafced
Implement loading namespaces with the using keyword (#338)
* Add using namespace as to scanner and parser

* Change the alias from id() to con()

* Add using namespace to AST type inference

* Allow using namespace to appear in the top level

* Allow using namespace to appear inside functions

* Add a compiler test for using namespace

* Handle name collisions

* Implement mk_error for ambiguous_name

* Add failing test for ambiguous names

* Limit the scope of the used namespaces

* Add test for wrong scope of using namespace

* Use a single using declaration

* Split long line

* Forbid using undefined namespaces

* Add a test for using undefined namespaces

* Change the type of used_namespaces

* Add using namespace parts to scanner and parser

* Add using namespace parts to ast type inference

* Add tests for using namespace parts

* Update CHANGELOG.md

* Code cleaning

* Update the docs

* Update the docs about the same alias for multiple namespaces
2021-09-07 17:45:28 +03:00
Radosław Rowicki
ae3edac53e
Prepare 6.0.2 (#326)
* Prepare 6.0.2

* Minor note
2021-07-06 17:31:35 +02:00
Ulf Norell
d07b321b25 Fix #324: bug when compiling default init in the presence of child contracts 2021-07-05 09:29:43 +02:00
Hans Svensson
4f68729631 Prepare v6.0.1 2021-06-24 09:34:05 +02:00
radrow
75b2d6981f Fix calldata 2021-06-22 17:54:05 +02:00
Radosław Rowicki
e2af89287d
6.0.0 (#317)
* Prepare 6.0.0

* Update docs

* Prepare 6.0.0 one more time

* the
2021-05-26 13:06:56 +02:00
Radosław Rowicki
e8b32a6875
Call.fee (#313)
* Call.fee

* nice align
2021-05-24 14:30:57 +02:00
Radosław Rowicki
cca7bdff49
Prepare 5.1.0 (#312) 2021-05-24 11:01:59 +02:00
Radosław Rowicki
1d9f59fec3
Contract factories and bytecode introspection (#305)
* Support for CREATE, CLONE and BYTECODE_HASH

* Add missing files

* Pushed the clone example through the typechecker

* CLONE compiles

* Fix dependent type in CLONE

* Bytecode hash fixes

* Refactor

* Refactor 2

* move some logic away

* Fixed some error messages. Type inference of child contract still does some random shit\n(mistakes arguments with result type)

* CREATE sometimes compiles and sometimes not

* Fix some scoping/constraint issues

* works, needs cleanup

* cleanup

* Fix some tests. Remove optimization of singleton tuples

* Fix default argument for clone

* Cleanup

* CHANGELOG

* Mention void type

* Address review, fix some dialyzer errors

* Please dialyzer

* Fix failing tests

* Write negative tests

* Docs

* TOC

* missing 'the'

* missing 'the'

* missing 'the'

* missing 'the'

* mention pre-fund

* format

* pre-fund clarification

* format

* Grammar in docs
2021-05-18 12:21:57 +02:00