bugGNU Octave - Bugs: bug #61843, Regression with subscripted...

 
 

bug #61843: Regression with subscripted assignments with arrays of objects

Submitter:  Guillaume <gyom>
Submitted:  Mon 17 Jan 2022 05:13:05 PM UTC
   
 
Category:  Classdef Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 17 Oct 2022 12:41:09 PM UTC, comment #5: 

This had already regressed in Octave 6.4. (I haven't tested in which version exactly.) Imho, we shouldn't block Octave 7.3 on this.

Changing release to "dev".

Markus Mützel <mmuetzel>
Group administrator
Thu 02 Jun 2022 12:11:17 PM UTC, comment #4: 

Changing the release target to 7.1.0 because this is a regression iiuc.

Markus Mützel <mmuetzel>
Group administrator
Tue 25 Jan 2022 07:42:40 PM UTC, comment #3: 

just playing with structs and not classes, the following works in both matlab and octave, so it seems to be class specific?


>> a = struct('b',1)
a =
  scalar structure containing the fields:
    b = 1

>> c = struct('d',a)
c =
  scalar structure containing the fields:
    d =
      scalar structure containing the fields:
        b = 1

>> c.d
ans =
  scalar structure containing the fields:
    b = 1

>> c.d.b
ans = 1

>> c.d.b = 3
c =
  scalar structure containing the fields:
    d =
      scalar structure containing the fields:
        b = 3

>> clear c

>> c(1) = struct('d',a)
c =
  scalar structure containing the fields:
    d =
      scalar structure containing the fields:
        b = 1

>> c(2) = struct('d',a)
c =
  1x2 struct array containing the fields:
    d

>> c.d
ans =
  scalar structure containing the fields:
    b = 1

ans =
  scalar structure containing the fields:
    b = 1

>> c.d.b
error: a cs-list cannot be further indexed

>> c(1).d.b
ans = 1

>> c(2).d.b
ans = 1

>> c(2).d.b = 3
c =
  1x2 struct array containing the fields:
    d

>> c(2).d.b
ans = 3


Nicholas Jankowski <nrjank>
Group Member
Tue 25 Jan 2022 06:57:04 PM UTC, comment #2: 

this does seem to be a compatability concern:

matlab 2021b:

>> obj(1) = foo;
obj(2) = foo;
obj(1).a.b

ans =

     1

>> obj(1).a.b = 2

obj =

  1×2 foo array with properties:

    a

>> obj(1).a.b

ans =

     2


Nicholas Jankowski <nrjank>
Group Member
Tue 18 Jan 2022 10:17:30 AM UTC, comment #1: 

Fails for me also with Octave 6.4.0. So, it doesn't look like a very recent regression.

Markus Mützel <mmuetzel>
Group administrator
Mon 17 Jan 2022 05:13:05 PM UTC, original submission:  

There seems to be a regression with subsasgn in the context of array of objects and chained assignments. The following code works in 5.2 but returns the error below with dev:


classdef foo
  properties
    a;
  endproperties
  methods
    function obj = foo
      obj.a = struct ("b", 1);
    endfunction
  endmethods
endclassdef



obj(1) = foo;
obj(2) = foo;
obj(1).a.b
  ans = 1
obj(1).a.b = 2
  error: invalid dot name structure assignment because the structure array is empty.  Specify a subscript on the structure array to resolve.


Guillaume <gyom>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-23 mmuetzel CategoryInterpreter Classdef
    2022-10-17 mmuetzel Release7.1.0 dev
    2022-06-02 mmuetzel Release7.0.90 7.1.0
    2022-01-18 mmuetzel StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code