Carp/core
Scott Olsen 5d530b7491
feat: register MAX and MIN macros for stdint types (#1412)
* feat: register MAX and MIN macros for stdint types

Adds MAX and MIN for each INT<N> type and MAX for each UINT<N> type.
These are macros defined by stdint.h and are sometimes useful for bounds
determinations and conversions and such.

* feat: make MAX and MIN interfaces

Since several numeric types define maximum and minimum values, it makes
sense for these to be defined as interfaces. This commit also makes
existing definitions of MAX and MIN for Carp's numeric types implement
the interfaces.

* fix: respect let binding shadowing in memory management (#1413)

* fix: respect let binding shadowing in memory management

Previously, we didn't account for shadowing in let bindings in our
memory management routines. This led to rare situations in which
multiple deleters might be added for a single variable name, for
example:

```clojure
(defn n [xs]
  (let [xs [1 2 3]
        n &xs]
    n))
```

The borrow checker would fail on this code since it would assign `xs`
two deleters, one for the untyped argument and another for the let
binding.

Instead, we now perform *exclusive* ownership transfer for the duration
of the let scope--when a shadow is introduced, the previous deleters for
that variable name are dropped until the end of the let scope, since we
evaluate all instances of the shadowed name to the more local binding.
At the end of the let scope, the original deleter is restored.

Fixes issue #597

* refactor: improved dead reference error for let

Since let scopes resolve to their bodies, we can report the body of the
let as the xobj producing an error when a dead reference is returned.

* test: update error message for dead refs in let

* test: add regression test for issue #597

Ensure we don't regress and fail to manage memory when let bindings
shadow function argument names.

* fix: respect symbol modes on interface concretization (#1415)

* fix: respect symbol modes on interface concretization

When concretizing interfaces (finding the appropriate implementation at
a call site) we previously set the lookup mode of all such resolved
symbols to CarpLand AFunction. This incorrectly overwrites the lookup
mode of Externally registered types, causing them to emit incorrect C
when the user specifies an override.

We now preserve whatever lookup mode is assigned to the implementation
the concretization resolves the interface to. This not only fixes the
external override emission issue, but should be more correct in general.

fixes #1414

* test: add regression test for issue #1414
2022-04-13 09:32:46 +02:00
..
Array.carp feat: scan functions (#1339) 2021-10-22 06:59:40 +02:00
ArrayExt.carp core: update dcostring for range-or-default 2020-05-24 12:51:11 +02:00
Bench.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Binary.carp feat: implement blit on ByteOrder (#1410) 2022-04-06 09:49:00 +02:00
Blitable.carp feat: Remove address (#1223) 2021-05-27 22:04:46 +02:00
Bool.carp core: add Bool.zero 2020-06-23 12:26:53 +02:00
BoolExtras.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Box.carp feat: add box type (#1358) 2021-11-30 10:35:22 +01:00
Byte.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
carp_bench.h Replace return by pure. (#1009) 2020-11-24 06:09:15 +01:00
carp_binary.h all: various long fixes 2020-04-23 21:50:30 +02:00
carp_bool.h core: do not have short functions on single lines 2019-10-30 11:07:32 +01:00
carp_byte.h core: fix #688 by using the correct formatting macros\n\n(and pray that windows does c99) 2020-02-21 12:28:34 +01:00
carp_char.h feat: add Char.to-byte and Char.from-byte (#1187) 2021-03-16 11:14:16 +01:00
carp_debug.h Preserve includes order in generated output. 2019-10-03 00:23:27 +02:00
carp_double.h Long type to ensure longs are actually 64 bits. 2020-04-22 10:40:06 +02:00
carp_float.h fix: run ormolu and clang-format (#1312) 2021-09-15 19:49:20 +02:00
carp_int.h core: do not have short functions on single lines 2019-10-30 11:07:32 +01:00
carp_io.h IO.Raw (#1243) 2021-06-17 17:33:10 +02:00
carp_long.h Detect __builtin_x_overflow() based on __GNUC__ macro. 2020-05-23 19:03:07 +02:00
carp_memory.h all: various long fixes 2020-04-23 21:50:30 +02:00
carp_pattern.h fix: run ormolu and clang-format (#1312) 2021-09-15 19:49:20 +02:00
carp_safe_int.h Detect __builtin_x_overflow() based on __GNUC__ macro. 2020-05-23 19:03:07 +02:00
carp_stdbool.h core: remove stdbool dependency 2018-11-17 15:42:36 +01:00
carp_stdint.h feat: register MAX and MIN macros for stdint types (#1412) 2022-04-13 09:32:46 +02:00
carp_string.h fix: escape quotes in String.prn (#1287) 2021-07-29 08:30:42 +02:00
carp_system.h IO.Raw (#1243) 2021-06-17 17:33:10 +02:00
carp_utf8.h Unicode fixes (#994) 2020-11-22 06:45:26 +01:00
Char.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Color.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Control.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
ControlMacros.carp Update ControlMacros.carp (#1336) 2021-10-14 10:24:59 +02:00
Core.carp feat: add box type (#1358) 2021-11-30 10:35:22 +01:00
core.h fix: added missing definitions so Carp can be used with TCC 32bit on Windows (#1267) 2021-07-01 10:20:42 +02:00
Debug.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Derive.carp docs: fix typo in make-deriver and add implementor note (#1155) 2021-01-27 19:00:31 +01:00
Double.carp feat: register MAX and MIN macros for stdint types (#1412) 2022-04-13 09:32:46 +02:00
Dynamic.carp feat: add Dynamic.Debug.trace (#1279) 2021-07-14 08:14:07 +02:00
Filepath.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Float.carp feat: register MAX and MIN macros for stdint types (#1412) 2022-04-13 09:32:46 +02:00
Format.carp fix: fix leading % format in fmt (#1380) 2022-01-24 13:05:27 +01:00
Function.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Generics.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Gensym.carp feat: allow for multibranches in case (#1276) 2021-07-08 20:43:48 +02:00
Geometry.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
GLFW.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Heap.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Int.carp feat: register MAX and MIN macros for stdint types (#1412) 2022-04-13 09:32:46 +02:00
Interfaces.carp feat: register MAX and MIN macros for stdint types (#1412) 2022-04-13 09:32:46 +02:00
Introspect.carp feat: add Introspect.arguments (#1163) 2021-02-01 17:03:38 +01:00
IO.carp feat: add IO.fgetc (#1405) 2022-03-28 10:16:51 +02:00
List.carp feat: Adds Dynamic.sort & improves output of failing dynamic tests (#1411) 2022-04-09 07:04:16 +02:00
Long.carp feat: register MAX and MIN macros for stdint types (#1412) 2022-04-13 09:32:46 +02:00
Macros.carp feat: add c-name meta field (#1398) 2022-03-18 09:34:45 +01:00
Map.carp fix: Unify aupdate and aupdate! with other update functions (#1220) 2021-05-25 12:11:31 +02:00
Maybe.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Opaque.carp Update Opaque docs; fix typos 2020-06-18 09:57:28 -04:00
OpenGL.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Pattern.carp fix: ensure registered types with fields emit path (#1364) 2021-12-16 21:31:16 +01:00
Phantom.carp core: add docs for phantom 2020-06-17 19:06:49 +02:00
Platform.carp feat: Recognize the NetBSD platform. (#1109) 2021-01-03 13:22:56 +01:00
Pointer.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Project.carp feat: Emit docs for top level bindings (#1253) 2021-06-28 19:56:59 +02:00
Quasiquote.carp (and) and (or) now handle any number of parameters (#1251) 2021-06-20 21:44:04 +02:00
Random.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Result.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
SafeInt.carp Added --compile-fast to compile with tcc. 2020-05-21 20:04:54 +02:00
SDL_gfx.carp Refactored flags handling (add-pkg). 2019-06-17 09:02:34 +02:00
SDL_image.carp Add support for cross-compilation. 2020-10-10 20:01:18 +02:00
SDL_mixer.carp Merge 2020-05-11 16:10:35 +02:00
SDL_ttf.carp Merge 2020-05-11 16:10:35 +02:00
SDL.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
SDLHelper.h core: fix SDL for newer versions 2020-10-15 13:14:31 +02:00
Sort.carp core: add sort flavors with custom comparators 2018-11-13 11:11:21 +01:00
StaticArray.carp feat: scan functions (#1339) 2021-10-22 06:59:40 +02:00
Statistics.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
StdInt.carp feat: register MAX and MIN macros for stdint types (#1412) 2022-04-13 09:32:46 +02:00
String.carp feat: add Dynamic.String.to-array (#1382) 2022-02-14 09:31:13 +01:00
System.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Test.carp feat: Adds Dynamic.sort & improves output of failing dynamic tests (#1411) 2022-04-09 07:04:16 +02:00
Tuples.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Unit.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Unsafe.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Vector.carp docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00