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

 
 

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

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

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

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>
Project 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>
Project 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>
Project Member
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 project members can vote.

     

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-01-18 mmuetzel StatusNone => Confirmed

    Back to the top


    Powered by Savane 3.9