Skip to content
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

Safe navigation is invalid for assigning variables #11379

Closed
RblSb opened this issue Nov 15, 2023 · 2 comments
Closed

Safe navigation is invalid for assigning variables #11379

RblSb opened this issue Nov 15, 2023 · 2 comments
Assignees

Comments

@RblSb
Copy link
Member

RblSb commented Nov 15, 2023

class Main {
  static function main() {
    final test = new Main();
    test?.foo(); // ok
    test?.bool = true; // Invalid operation
  }

  public function new() {}
  public function foo():Void {}
  public var bool = true;
}

I think this can be supported too, like calls? Works in kotlin

@Simn
Copy link
Member

Simn commented Nov 17, 2023

I actually find "assign it if it's not null" a very strange concept, but the += case makes sense to me. So I guess supporting both would be fine.

@Simn Simn self-assigned this Nov 17, 2023
@Simn
Copy link
Member

Simn commented Nov 17, 2023

Oh right it's not about the field being null but the thing we're accessing the field on. So yes both cases make sense.

@Simn Simn closed this as completed in dc453c8 Nov 17, 2023
@kLabz kLabz added this to the 4.3 Hotfix candidates milestone Nov 17, 2023
0b1kn00b pushed a commit to 0b1kn00b/haxe that referenced this issue Jan 25, 2024
@kLabz kLabz mentioned this issue Feb 18, 2024
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants