Announcement

Collapse
No announcement yet.

[#4105] error at string addition in version 17.10

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • erwin
    started a topic [#4105] error at string addition in version 17.10

    [#4105] error at string addition in version 17.10

    In following constellation (element from class/struct) do'nt function the string addition '+=' !
    In previous version (example 16.8) it was ok.

    public static class App
    {
       public struct st
       {
          public string s0;
       }
    
       public static void Main()
       {
          cl myCl = new cl();
          myCl.str = new App.st();
    
          myCl.str.s0 = "a";
    
          myCl.str.s0 += "b";
       }
    
       class cl
       {
           public App.st str;
       }
    -> bridge.net compile:

    var myCl = new gecomain.cl();
    myCl.str = new gecomain.App.st();
    
    myCl.str.s0 = "a";
    
    ($t = myCl.str.$clone()).s0 = ($t.s0 || "") + "b";
    -> result for myCl.str.s0: "a"
    Last edited by geoffrey.mcgill; 2020-01-27 @ 09:12 PM.

  • geoffrey.mcgill
    replied
    The following issue was created to track this defect:

    https://github.com/bridgedotnet/Bridge/issues/4105

    Leave a comment:


  • geoffrey.mcgill
    replied
    Here's a sample using class and member names that are easier to follow:

    https://deck.net/818b2b71daed9cde5d145bbcc5b0e409

    public static class Program
    {
        public struct Book
        {
            public string Title;
        }
    
        public static void Main()
        {
            var delivery = new Delivery();
            delivery.Books = new Book[1];
            delivery.Books[0] = new Book();
    
            delivery.Books[0].Title = "Animal";
            delivery.Books[0].Title += " Farm";
    
            // Expected: Animal Farm
            // Actual:   Animal
            Console.WriteLine(delivery.Books[0].Title);
        }
    }
    
    public class Delivery
    {
        public Program.Book[] Books;
    }

    Leave a comment:


  • geoffrey.mcgill
    replied
    Thanks for the sample. I formatted your sample properly and provided a comment with the Expected and Actual result.

    https://deck.net/2301e93ced406bb907ffe8e9d1f2344d

    public static class Program
    {
        public struct st
        {
            public string s0;
        }
    
        public static void Main()
        {
            cl myCl = new cl();
            myCl.str = new st[1];
            myCl.str[0] = new st();
    
            myCl.str[0].s0 = "a";
            myCl.str[0].s0 += "b";
    
            // Expected: ab
            // Actual:   a
            Console.WriteLine(myCl.str[0].s0);
        }
    }
    
    class cl
    {
        public Program.st[] str;
    }
    This does appear to be a defect. I will log as an issue and we will do our best to fix as quickly as we can.

    Leave a comment:


  • erwin
    replied
    https://deck.net/53b1c4030c4bb6079c34c7ffa9f1459a

    Leave a comment:


  • geoffrey.mcgill
    replied
    Hi. Can you provide a link to a Deck.NET sample demonstrating this issue?

    Leave a comment:

Working...
X