Skip to content

Regression in type inference #22713

Open
@WojciechMazur

Description

@WojciechMazur

Issues observed in multiple OpenCB projects, currently reproduced based on tkrs/fluflu
All of the projects below are pointing to the same commit when performing a project-wise bisect.

Project Name Version Build Logs Notes
ichoran/kse3 0.3.11 Open CB logs Needs minimization
appliedtopology/tda4j 0.1.0-alpha Open CB logs Needs minimization
thoughtworksinc/dsl.scala 2.0.0 Open CB logs Needs minimization
sagifogel/proptics 0.5.2 Open CB logs Needs minimization
quafadas/vecxt 0.0.25 -> 0.0.26 Open CB logs Needs minimization
unibas-gravis/scalismo 1.0-RC1 Open CB logs Needs minimization
tkrs/fluflu 0.24.11 Open CB logs Reproducer below

Compiler version

3.7.0-RC1-NIGHTLY
Bisect points to #21744 - 32ac2e6

Minimized code

import java.util.concurrent.ScheduledExecutorService
import java.util.concurrent.TimeUnit

def Test = {
  val worker: ScheduledExecutorService = ???
  object Worker extends Runnable {
    def fails(): Either[Exception, Unit] = Right(worker.schedule(this, 5, TimeUnit.NANOSECONDS))
    def works(): Either[Exception, Unit] = Right {
      worker.schedule(this, 5, TimeUnit.NANOSECONDS); ()
    }
    def run(): Unit = ???
  }
}

Output

-- [E007] Type Mismatch Error: /Users/wmazur/projects/scala/community-build3/test.scala:7:65 ---------------------------------------------------------------------------------------------------------------
7 |    def fails(): Either[Exception, Unit] = Right(worker.schedule(this, 5, TimeUnit.NANOSECONDS))
  |                                                                 ^^^^
  |                                                                 Found:    (test$package.Worker : Worker.type)
  |                                                                 Required: java.util.concurrent.Callable[V]
  |
  |                                                                 where:    V is a type variable

Expectation

Should compile

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions