Skip to content

fix: derive generic method call shapes from declarations#463

Merged
ivov merged 1 commit into
mainfrom
derive-generic-method-call-shapes
May 20, 2026
Merged

fix: derive generic method call shapes from declarations#463
ivov merged 1 commit into
mainfrom
derive-generic-method-call-shapes

Conversation

@ivov

@ivov ivov commented May 20, 2026

Copy link
Copy Markdown
Owner

Generic method calls now compile when the result is bound and when function or spread arguments need shape adaptation, using the method's declared shape instead of the instantiated type. This extends #461 from free functions to methods.

pub interface Face {}

pub fn resultant(arg: int) -> Result<int, Face> {
  Ok(arg)
}

pub struct Holder { pub n: int }

impl Holder {
  pub fn resolve<R, E>(self, f: fn(int) -> Result<R, E>) -> Result<R, E> {
    f(self.n)
  }
}

fn main() {
  let rez = Holder { n: 4 }.resolve(resultant)
  let _ = rez
}

@ivov ivov merged commit b4c22b5 into main May 20, 2026
13 checks passed
@ivov ivov mentioned this pull request May 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Released in lisette-v0.2.9

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

Successfully merging this pull request may close these issues.

1 participant