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

[addr me: Self*] CHECK failure when used in interface method #2223

Closed
zygoloid opened this issue Sep 28, 2022 · 0 comments · Fixed by #2374
Closed

[addr me: Self*] CHECK failure when used in interface method #2223

zygoloid opened this issue Sep 28, 2022 · 0 comments · Fixed by #2374
Assignees
Labels
explorer Action items related to Carbon explorer code

Comments

@zygoloid
Copy link
Contributor

Testcase:

package Foo api;

interface Container {
  fn Add[addr me: Self*](x: i32);    
}
fn Add[T:! Container](p: T*, y: i32) {      
  (*p).Add(y);
}

class X {
  impl as Container {                                                 
    fn Add[addr me: Self*](x: i32) { Print("Add {0}", x); }
  }
}
fn Main() -> i32 {
  var x: X = {};
  Add(&x, 5);
  return 0;
}

... results in:

CHECK failure at explorer/interpreter/interpreter.cpp:274: v->kind() == Value::Kind::LValue

Looks like we currently only call set_is_field_addr_me_method for direct calls on a NominalClassType. Presumably we should set that for all simple and compound member accesses where the target is a method and we're not forming a member name expression.

@jonmeow jonmeow added the explorer Action items related to Carbon explorer code label Sep 28, 2022
@zygoloid zygoloid self-assigned this Nov 5, 2022
zygoloid added a commit to zygoloid/carbon-lang that referenced this issue Nov 5, 2022
jonmeow pushed a commit that referenced this issue Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
explorer Action items related to Carbon explorer code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants