New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`@:structInit` extends `@:structInit` issues #6822

Closed
Yanrishatum opened this Issue Jan 20, 2018 · 0 comments

Comments

Projects
None yet
3 participants
@Yanrishatum
Copy link
Contributor

Yanrishatum commented Jan 20, 2018

Test builds: 577f0c9 and 616f751

If one @:structInit class extends another @:structInit class, Haxe expects fields only for super class and throws an error saying that struct initialization contains extra fields. This should not happen when explicitly constructing extending class.
Error example:
{ somethingElse : Int, something : Int } has extra field somethingElse

E.g. expected behavior akin to typedef extending.

typedef Thing =
{
  > OtherThing,
  // ...
}

Most likely related: #6078

Reproduction code

package;

class Main
{
  static function main() 
  {
    var thing:Thing = { something: 0 };
    var bigThing:BiggerThing = { something: 1, somethingElse: 2 };
  }
}

@:structInit
class Thing
{
  public var something:Int;
}

@:structInit
class BiggerThing extends Thing
{
  public var somethingElse:Float;
}

@nadako nadako added the bug label Feb 1, 2018

@skial skial referenced this issue Feb 22, 2018

Closed

Haxe Roundup 420 #479

0 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment