Announcement

Collapse
No announcement yet.

[CLOSED] [#471] Lambda expressions crash the compiler

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

    [CLOSED] [#471] Lambda expressions crash the compiler

    Hello,

    I'm not sure if this shouldn't be instead a feature request, but it seems that a simple example with lambda expressions is crashing the Bridge.net compiler.

    Click image for larger version

Name:	bridge.net_exception.png
Views:	1
Size:	58.6 KB
ID:	665
    using System;
    
    namespace mathtest
    {
        public class vec3
        {
            public float x;
            public float y;
            public float z;
    
            public vec3()
            {
                x = 0;
                y = 0;
                z = 0;
            }
    
            public vec3(float a, float b, float c)
            {
                x = a;
                y = b;
                z = c;
            }
    
            public float Length => (float)Math.Sqrt(((x * x + y * y) + z * z));
        }
    }

    #2
    Hi,

    Your code requires C# 6 support. But Bridge v1.x support C# 5 only
    Please retest with Bridge v2 (which has C# 6 support) when it will be released

    Comment


      #3
      Moved the Help forum and created a GitHub issue to test it with Bridge 2.0.
      https://github.com/bridgedotnet/Bridge/issues/471

      Comment


        #4
        C#6 Lambda Expressions have been supported in Bridge since the version 15.0 release. The original vec3 sample works great now.

        http://deck.net/2438579be4e9fa8c5746e8d37797ac95

        public class Program
        {
            public static void Main() => new Program().Init();
            
            public void Init()
            {
                var v = new vec3(1.5f, 2.5f, 3.5f);
                
                // should be 4.555217
                Console.WriteLine(v.Length);
            }
        }
        
        public class vec3
        {
            public float x;
            public float y;
            public float z;
        
            public vec3()
            {
                x = 0;
                y = 0;
                z = 0;
            }
        
            public vec3(float a, float b, float c)
            {
                x = a;
                y = b;
                z = c;
            }
        
            public float Length => (float)Math.Sqrt(((x * x + y * y) + z * z));
        }

        Comment

        Working...
        X