Skip to content

Class generation error on an usage of "auto" with intersection types #770

Description

@dzmauchy

Describe the bug
the "auto" return type on a method with a intersection return type leads to a compilation error

To Reproduce
Steps to reproduce the behavior:

  1. Create a simple class with a method with auto return type and an intersection actual type
  2. Compile the java file
  3. Get an error like "error: error while generating class Main
    (illegal signature attribute for type INT#1)"

Expected behavior
The compilation is successful

Screenshots

Image

Desktop (please complete the following information):

  • OS Type & Version: Manjaro Linux
  • Java/JDK version: OpenJDK 25
  • IDE version (IntelliJ IDEA or Android Studio): 2026.1
  • Manifold version: 2026.1.6
  • Manifold IntelliJ plugin version: 2026.1.7

Additional context
Gradle compilation with

tasks.withType<JavaCompile> {
  options.compilerArgs.add("-Xplugin:Manifold")
}

of a java file

import manifold.ext.rt.api.auto;

import java.util.List;

public class Main {

  public static auto x() {
    return List.of(1, "2");
  }

  static void main(String[] args) throws Exception {
    var method = Main.class.getMethod("x");
    System.out.println(method.getGenericReturnType());
  }
}

Stack trace

error: error while generating class Main
  (illegal signature attribute for type INT#1)
error: error while generating class Main

  where INT#1,INT#2 are intersection types:
    INT#1 extends Object,Serializable,Comparable<? extends INT#2>,Constable,ConstantDesc
    INT#2 extends Object,Serializable,Comparable<?>,Constable,ConstantDesc
1 error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions