nitra icon indicating copy to clipboard operation
nitra copied to clipboard

AST: Cannot use implicit cast

Open ssrmm opened this issue 8 years ago • 1 comments

Using an implicit cast when assigning some property results in a compilation error:

namespace Test.Ast
{
  ast Foo 
  {
    in Test1 : string;

    Test1 = StringWrapper("Test"); // error : Unexpected expression 'this.Test1 = (macro_Nitra.PExprAnchorMacro:     
  }                                //	  DEBUG_INFO(Test.StringWrapper ("Test")) :> string)' Assign
}
namespace Test
{
  [Record]
  class StringWrapper
  {
      private Value : string;
      
      public static @:(sw : StringWrapper) : string
      {
          sw.Value
      }
  }
}

ssrmm avatar Nov 10 '16 12:11 ssrmm

A type cast not yet supported. Use a method call instead.

VladD2 avatar Nov 10 '16 23:11 VladD2