zinc icon indicating copy to clipboard operation
zinc copied to clipboard

SAM type change causes undercompilation

Open eed3si9n opened this issue 4 years ago • 0 comments

This is yet another example of Zinc lagging Scala language spec change. https://www.scala-lang.org/news/2.12.0/#lambda-syntax-for-sam-types

steps

Haven't minimized it but I noticed while coding. First you have a Java interface in one subproject.

import java.nio.file.Path;
import java.util.Optional;

public interface SingleOutput {
    public Path getOutputDirectory();

    public default Optional<Path> getSingleOutput() {
        return Optional.of(getOutputDirectory());
    }
}

In another subproject, use it as SAM-type lambda:

val output: SingleOutput = () => RootFilePath.resolve("out")

Then change the Java interface..

import java.io.File;
import java.util.Optional;

public interface SingleOutput {
    public File getOutputDirectory();

    public default Optional< File > getSingleOutput() {
        return Optional.of(getOutputDirectory());
    }
}

problem

The Scala code is not invalidated. So locally compile keeps succeeding. On CI the build fails if it's compiled from scratch.

expectation

Invalidate correctly.

eed3si9n avatar Jul 12 '20 04:07 eed3si9n