C# printer: a self-bounded interface's wildcard interface and companion class share a name (CS0102)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 64/100
Research direction
Start with the TestJavaToCSharpStructure.wildcardInterfaces case and its wildcardInterfaces-Lifecycles.cs golden file. Check how the C# printer emits wildcard interfaces and companion statics, then choose one of the two fixes described in the issue and update the assertion. Done means the generated C# has no duplicate IImpacter declaration and the structure test expects the chosen output.
Written by the indexing model from the issue text.
Description
A generic interface whose type parameter is self-bounded, with a static method, gets both a wildcard interface (CSharpWildcardInterfaces) and a companion class for its statics. Both are named after the non-generic interface, so C# rejects the type (CS0102).
Java, from TestJavaToCSharpStructure.wildcardInterfaces (LIFECYCLES):
public interface Grade<G extends Grade<G>> { }
public interface Impacter<G extends Grade<G>> {
java.util.List<G> impacts();
static <G extends Grade<G>> Impacter<G> none() { return null; }
}
static int impacts(Impacter<?> impacter) { return impacter.impacts().size(); }
C#, from the golden file wildcardInterfaces-Lifecycles.cs:
public interface IImpacter<G> : IImpacter where G : IGrade<G> { ... }
public interface IImpacter { }
public static class IImpacter { public static IImpacter None() => null; }
Roslyn: error CS0102: The type 'Lifecycles' already contains a definition for 'IImpacter'.
For a type that isn't self-bounded, the companion's statics go into the wildcard interface itself (ITupleLifecycle.Same). The test's comment, "a self-bounded interface with a companion keeps both, as before the companion became the wildcard interface", and its assertion public static class IImpacter { both expect this output. So the golden file has never compiled, and the structure tests don't compile their golden files.
Possible fixes:
- Put the statics into the wildcard interface here too, as static interface members.
- Give the companion class another name.
Whichever is chosen, the test's assertion needs to change with it.
- Dominant language
- Java
- Stars
- 1
- Forks
- 1
- Avg merge
- 1h 34m
- Merged PRs (30d)
- 7
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CodeLaser/maddi
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CodeLaser/maddi#166 · 2 comments ·
Maintainers usually reply within 1 day
-
build/ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
front-end:rust
Difficulty 5/5 Over a week Newbie friendliness 30/100
Maintainers usually reply within 1 day
Similar issues
-
[Bug] [Go] Ack returns nil when the server answers with a non-OK statusPossibly taken @leizhiyuan claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/rocketmq-clients#1465 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
pdfium-drift
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Stirling-Tools/JPDFium#188 ·
Maintainers usually reply within 1 day
-
security
Difficulty 1/5 Under an hour Newbie friendliness 70/100
IBM/ibm-quarkus-ai-langchain4j-workshop#160 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openremote/openremote#3487 · 1 comment ·