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

[Bug]: dyno missing init-part when tuple splitting #26535

Open
riftEmber opened this issue Jan 14, 2025 · 3 comments
Open

[Bug]: dyno missing init-part when tuple splitting #26535

riftEmber opened this issue Jan 14, 2025 · 3 comments
Assignees

Comments

@riftEmber
Copy link
Member

riftEmber commented Jan 14, 2025

Summary of Problem

Description:
Dyno encounters an error assigning a variable via splitting a tuple formal containing a class type. It seems to be missing an init-part for the variable being initialized, so tries to default-init it, which is not possible for a non-nil class type.

Is this issue currently blocking your progress?
Blocking for #26077.

Steps to Reproduce

Source Code:

Simpler reproducer:

class Foo {}

proc asdf () {
  var (first) = (new Foo(),);
}
asdf();

Original reproducer:

proc asdf(x) {
  var (first) = x;
}

class Foo {
  proc bar() {
    var tup = (this,);
    asdf(tup);
  }
}

var myFoo = new Foo();
myFoo.bar();

Compile command:
testInteractive or chpl --dyno

Results in error message:

─── error in mytest.chpl:2 ───
  Cannot default initialize variable using non-nilable class type
@riftEmber riftEmber changed the title [Bug]: dyno tries to default-init a borrowed in tuple splitting [Bug]: dyno missing init-part when tuple splitting Jan 14, 2025
@riftEmber
Copy link
Member Author

It doesn't have to be a borrowed, just anything that can't be default-inited, since the underlying problem is missing init part. And it doesn't have to be a formal, just in a proc so call-init-deinit checks happen. Added simpler reproducer and changed title.

@riftEmber riftEmber self-assigned this Jan 14, 2025
@riftEmber
Copy link
Member Author

Another reproducer that gets all the way through production:

class Foo {}
proc asdf () {
  var myFoo = new Foo();
  var (first, second) = (myFoo.borrow(), 2);
}
asdf();

@riftEmber
Copy link
Member Author

Made backing issue https://github.com/Cray/chapel-private/issues/7021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant