Skip to content

Commit

Permalink
Fix set/mapping overrides for Sequence.clear being ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
GrieferAtWork committed Dec 22, 2024
1 parent 157361d commit 066e14d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/deemon/objects/seq/default-api-require-method-impl.c.inl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//#define DEFINE_DeeType_RequireSeqBoundLast
//#define DEFINE_DeeType_RequireSeqDelLast
//#define DEFINE_DeeType_RequireSetLast
#define DEFINE_DeeType_RequireCached
//#define DEFINE_DeeType_RequireCached
//#define DEFINE_DeeType_RequireSeqAny
//#define DEFINE_DeeType_RequireSeqAnyWithKey
//#define DEFINE_DeeType_RequireSeqAnyWithRange
Expand Down Expand Up @@ -86,7 +86,7 @@
//#define DEFINE_DeeType_RequireSeqAppend
//#define DEFINE_DeeType_RequireSeqExtend
//#define DEFINE_DeeType_RequireSeqXchItemIndex
//#define DEFINE_DeeType_RequireSeqClear
#define DEFINE_DeeType_RequireSeqClear
//#define DEFINE_DeeType_RequireSeqPop
//#define DEFINE_DeeType_RequireSeqRemove
//#define DEFINE_DeeType_RequireSeqRemoveWithKey
Expand Down Expand Up @@ -666,9 +666,8 @@ DECL_BEGIN
#define LOCAL_Bar XchItem
#define LOCAL_ATTR_REQUIRED_SEQCLASS Dee_SEQCLASS_SEQ
#elif defined(DEFINE_DeeType_RequireSeqClear)
#define LOCAL_foo clear
#define LOCAL_Foo Clear
#define LOCAL_ATTR_REQUIRED_SEQCLASS Dee_SEQCLASS_SEQ
#define LOCAL_foo clear
#define LOCAL_Foo Clear
#elif defined(DEFINE_DeeType_RequireSeqPop)
#define LOCAL_foo pop
#define LOCAL_Foo Pop
Expand Down
31 changes: 31 additions & 0 deletions util/test/deemon-hashset-clear.dee
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/deemon
/* Copyright (c) 2018-2024 Griefer@Work *
* *
* This software is provided 'as-is', without any express or implied *
* warranty. In no event will the authors be held liable for any damages *
* arising from the use of this software. *
* *
* Permission is granted to anyone to use this software for any purpose, *
* including commercial applications, and to alter it and redistribute it *
* freely, subject to the following restrictions: *
* *
* 1. The origin of this software must not be misrepresented; you must not *
* claim that you wrote the original software. If you use this software *
* in a product, an acknowledgement (see the following) in the product *
* documentation is required: *
* Portions Copyright (c) 2018-2024 Griefer@Work *
* 2. Altered source versions must be plainly marked as such, and must not be *
* misrepresented as being the original software. *
* 3. This notice may not be removed or altered from any source distribution. *
*/

import * from deemon;

local x = HashSet({ "a", "b", "c", "d" });
x.clear();

assert !x;
assert #x == 0;
assert x == {};
assert x.isempty;
assert !x.isnonempty;

0 comments on commit 066e14d

Please sign in to comment.