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]: Inheriting from a generic class in a non-generic subclass causes internal error #26579

Open
jabraham17 opened this issue Jan 21, 2025 · 0 comments

Comments

@jabraham17
Copy link
Member

Inheriting from a generic class in a class that is otherwise not generic results in an internal error.

class Generic {
  param x = 1;
}

class Parent {
  var x: borrowed Generic(?);
  proc init(x: borrowed Generic(?)) {
    this.x = x;
  }
}

class Child: Parent(?) {
  proc init(x: borrowed Generic(?)) {
    super.init(x);
  }
}

var g = new Generic();
var c = new Child(g);

This hits an internal error on new Child(g) in resolvePromotionType while trying to resolve type constructors. Making the Child class explicitly generic by adding param dummy = 1; to resolves the issue. Note that this bug occurs regardless of if Generic is generic-with-defaults or not.

jabraham17 added a commit that referenced this issue Jan 23, 2025
Adds `Python.checkExceptions` (on by default), which allows users to
turn off the exception checking to avoid overhead.

This PR also includes a few other cleanups and adds a future for
#26579

- [x] `start_test test/library/packages/Python` 
- [x] `start_test test/library/packages/Python --compopts
-scheckExceptions=false`
- this has 1 expected failure of `argPassingTest`, which tests
exceptions

Future work:
- It would be nice to support this as a per-interpreter param as well,
but that opens us up to issues with generics and classes. So for now
thats a todo/nice-to-have

[Reviewed by @DanilaFe]
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