Commit Graph

20 Commits

Author SHA1 Message Date
Scott Olsen
5f0ae6819e
Various submodule fixes (#1078)
* fix: don't set the inner env to globals in type mods

Previously, we set the inner environment of a type generated module to
the global env in cases where the overarching context didn't have an
inner env. This leads to problems where by the recognition of modules is
inconsistent, and one can't use the names of types as submodules in
certain circumstances.

This commit fixes that issue.

* refactor: refactor primitiveDefmodule

This refactor fixes a issues with meta information on submodules, for
instance, sigs on submodule functions used to result in a compiler error
about ambiguous identifiers. This fixes that.

Unfortunately, I don't have a precise idea about what exactly was wrong
with the original definition of this function. My suspicion is that the
recursion originally altered submodule paths in the wrong way, but I'm
not certain. In any case it's fixed.

* fix: ensure macros are expanded in the correct module

Previously, macro expansions folded over all forms after the top level
form, without performing any context updates on encountered
`defmodules`. This created an issue in which macro calls that produced
new bindings, "meta stubs", were *hoisted* out of submodules and into
the top-level module, creating duplicate definitions.

This commit fixes that issue by adding a special case for defmodule in
macroExpand.

* fix: ensure submodules and globals don't conflict

Previously, our module lookups during new module definition always
eventually fell back to the global environment, which caused submodules
that happen to share a name with a global module to be confused with the
global module. This change fixes that, so now one can define both
`Dynamic` (global) and `Foo.Dynamic` without issue.

* fix: remove old prefixes from vector tests

Commit 7b7cb5d1e replaced /= with a generic function. However, the
vector tests still called the specific Vector variants of this function,
which were removed when the generic was introduced. After recent
changes, these calls are now (correctly) identified as erroneous. My
guess is that they only worked in the past because of problems with our
lookups.

* chore: format code
2020-12-18 21:45:28 +01:00
hellerve
9e2c2fe2fd test: add assert-ref-equal, assert-just, and assert-nothing 2020-05-12 14:53:42 +02:00
Jorge Acereda
08af49dc62 Working on generics.
- Added Generics module.
- Some Geometry/Vector* functions hardcoded parameters to Double.
2019-09-08 13:02:04 +02:00
hellerve
62d08d28ef test: fix tests for new maybe api 2019-02-13 11:46:22 +01:00
hellerve
c6a440d477 core: extend maybe and rework vector with it 2019-02-13 11:42:16 +01:00
hellerve
ca22bfc8cd test: use deftest everywhere 2018-11-08 07:16:52 +01:00
Craig Roy
92501770e6 Print results as part of test macro 2018-09-13 00:13:03 +01:00
Erik Svedäng
a9fd73ab2a Load 'Debug.carp' by default. 2018-03-13 09:43:08 +01:00
Erik Svedäng
8f256c5aef Bugfixing. 2018-02-05 10:49:35 +01:00
hellerve
8c77e75ea2 added parallelity and perpendicularity test 2017-12-28 17:44:20 +01:00
hellerve
33c0a542e3 core: added zero api to vctor 2017-12-28 17:22:25 +01:00
hellerve
ca6ecafbbc core: added arithmetic ref interfaces and regular arithmetic interfaces, renamed functions in vectors 2017-12-13 11:10:42 +01:00
hellerve
5704a9268c macros: added use-all 2017-12-12 15:08:33 +01:00
hellerve
89eb010045 tests: simplified 2017-11-27 14:45:14 +01:00
Erik Svedäng
88fd0dc32c Adding an interface for '/='. 2017-11-24 17:17:49 +01:00
Erik Svedäng
53494642b0 Fixed failing Vector tests due to new 'str' interface. 2017-11-23 22:36:15 +01:00
Erik Svedäng
db8ab73644 Removed autoloading of the more advanced libraries, requires manual loading. 2017-11-21 12:01:31 +01:00
hellerve
7151742518 vector: fixed test cases, also Array.copy for primitive types 2017-10-25 13:45:46 +02:00
hellerve
19fd0a686b vector: added test for lerp 2017-10-25 13:07:52 +02:00
hellerve
f8550e07a1 vectors: added n-dimensional vectors 2017-10-25 13:07:52 +02:00