Struct Issues #28

Open
opened 2025-10-27 12:03:21 +11:00 by DiamondNether90 · 3 comments

This is really two issues, but they are very closely linked.

  • Issue 1
    Attempting to get the type of a struct reports undefinedError: Could not get type?? This should never be reached. Please report this issue.

  • Issue 2
    I have the following code:

struct -Vector
    init &values -list
    
    fun -Vector !init -list &args
        init &vec -Vector
        set &vec $args
        return $vec
    endfun
endstruct

setlist &v1 1 2 3
pusharg $v1
init &vec1 -Vector
!vec1.init &vec1

The last line, !vec1.init, should error, as a list is returned instead of a Vector. However, it returns the list.

This is really two issues, but they are very closely linked. - Issue 1 Attempting to get the type of a struct reports `undefinedError: Could not get type?? This should never be reached. Please report this issue`. - Issue 2 I have the following code: ```cpp struct -Vector init &values -list fun -Vector !init -list &args init &vec -Vector set &vec $args return $vec endfun endstruct setlist &v1 1 2 3 pusharg $v1 init &vec1 -Vector !vec1.init &vec1 ``` The last line, `!vec1.init`, should error, as a list is returned instead of a Vector. However, it returns the list.
Author
Member

Another issue:
getlistsize &struct &len1
This gives a C++ Runtime Error:

terminate called after throwing an instance of 'std::bad_variant_access'
  what():  std::get: wrong index for variant
fish: Job 1, 'ground totallypseudocode.grnd' terminated by signal SIGABRT (Abort)

Instead of a ground error (something like struct is not a list would be expected).

Another issue: `getlistsize &struct &len1` This gives a C++ Runtime Error: ```fish terminate called after throwing an instance of 'std::bad_variant_access' what(): std::get: wrong index for variant fish: Job 1, 'ground totallypseudocode.grnd' terminated by signal SIGABRT (Abort) ``` Instead of a ground error (something like `struct is not a list` would be expected).
Author
Member

Another issue: getlistsize &struct.field &len2 returns syntaxError: Couldn't find the list vec2.values (vec2.values is a list).

I can use this code as a workaround:

set &val $struct.field
getlistsize &val &len
Another issue: `getlistsize &struct.field &len2` returns `syntaxError: Couldn't find the list vec2.values` (vec2.values is a list). I can use this code as a workaround: ```cpp set &val $struct.field getlistsize &val &len ```
Author
Member

Another bug: You can't jump within struct functions

Another bug: You can't jump within struct functions
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ground/ground-old#28