Skip to content

ShortcutImplicits conflicts with RefChecks #4753

Closed
@allanrenucci

Description

@allanrenucci
class A

trait Foo {
  def foo: implicit A => Int
}

class Test {
  new FooI{}
}

class FooI extends Foo {
  def foo: implicit A => Int = 3
}

fails to compile:

> dotc Test.scala
-- Error: tests/allan/Test.scala:8:2 -------------------------------------------
8 |  new FooI{}
  |  ^
  |object creation impossible, since def foo$direct(implicit x$0: A): Int is not defined 

The issue is that at the time RefChecks transforms new FooI{}, class FooI hasn't gone through ShortcutImplicits which creates the member def foo$direct(implicit x$0: A): Int but trait Foo has

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions