decision: when two impls match one tensor receiver, the more specific pattern wins

Open
#463 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
compilers

Research direction

Start with tests/frontend/pass/impl_most_specific_pattern_wins.vx and the resolver behavior described in the issue. Define how equal-specificity patterns such as [N, ?] and [?, M] should be diagnosed, including naming both matches, and account for the stated ordering of static, bounded, and ? dimensions. Done means the tie behavior is decided and covered by a regression test.

Written by the indexing model from the issue text.

Description

core-lang question

A [2, 2] receiver matches both impl<T> Tensor<T, [?, ?]> and impl<T, const N, const M> Tensor<T, [N, M]>. ae80cc0d resolves it by specificity: a static or const dimension is more specific than ?, and a ? receiver matches only the ? pattern (a const name refuses a run-time extent). tests/frontend/pass/impl_most_specific_pattern_wins.vx pins it with the static impl declared first, so the [?, ?] receiver reaching the ? impl is specificity and not declaration order.

Not decided: what a tie is. Two patterns of equal specificity matching one receiver ([N, ?] and [?, M] against [2, 2]) should be an error naming both; today whichever the resolver meets first wins. The bounded-extents RFC's ?<=B sits between static and ? in this order and needs it stated when it lands.

Dominant language
Rust
Stars
14
Forks
2
Avg merge
13h 13m
Merged PRs (30d)
70

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vx-lang/Vx

All issues in vx-lang/Vx

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.