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

[programgen] Spot and qualify duplicate identifiers #1569

Closed
lunaris opened this issue Jan 6, 2025 · 1 comment
Closed

[programgen] Spot and qualify duplicate identifiers #1569

lunaris opened this issue Jan 6, 2025 · 1 comment
Labels
area/codegen Code generation kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue

Comments

@lunaris
Copy link
Contributor

lunaris commented Jan 6, 2025

The l2-map-keys conformance test fails because two packages which provide a Resource class are imported, and the names are not qualified appropriately in order to avoid ambiguity:

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.primitive.Resource;
import com.pulumi.primitive.ResourceArgs;
import com.pulumi.primitiveref.Resource;
import com.pulumi.primitiveref.ResourceArgs;
import com.pulumi.primitiveref.inputs.DataArgs;
import com.pulumi.refref.Resource;
import com.pulumi.refref.ResourceArgs;
import com.pulumi.refref.inputs.DataArgs;
import com.pulumi.refref.inputs.InnerDataArgs;
import com.pulumi.plain.Resource;
import com.pulumi.plain.ResourceArgs;
import com.pulumi.plain.inputs.DataArgs;
import com.pulumi.plain.inputs.InnerDataArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var prim = new Resource("prim", ResourceArgs.builder()
            .boolean_(false)
            .float_(2.17)
            .integer(-12)
            .string("Goodbye")
            .numberArray(            
                0,
                1)
            .booleanMap(Map.ofEntries(
                Map.entry("my key", false),
                Map.entry("my.key", true),
                Map.entry("my-key", false),
                Map.entry("my_key", true),
                Map.entry("MY_KEY", false),
                Map.entry("myKey", true)
            ))
            .build());

...

Here, new Resource could refer to any of com.pulumi.primitive.Resource, com.pulumi.primitiveref.Resource, com.pulumi.plain.Resource, or com.pulumi.refref.Resource.

@lunaris lunaris added area/codegen Code generation kind/bug Some behavior is incorrect or out of spec labels Jan 6, 2025
@Zaid-Ajaj Zaid-Ajaj added the resolution/duplicate This issue is a duplicate of another issue label Jan 6, 2025
@Zaid-Ajaj
Copy link
Contributor

Duplicate of #1558

@Zaid-Ajaj Zaid-Ajaj marked this as a duplicate of #1558 Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/codegen Code generation kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants