Skip to content

Failed to convert A with B to A #10670

Open
@Atry

Description

@Atry
Welcome to Scala 2.12.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_152).
Type in expressions for evaluation. Or try :help.

scala> type A = {
     |   def self: Some[Any]
     | }
defined type alias A

scala> type B = {
     |   def self: Option[String]
     | }
defined type alias B

scala> def convert(ab: A with B): A = ab
<console>:13: error: type mismatch;
 found   : A with B
 required: A
    (which expands to)  AnyRef{def self: Some[Any]}
       def convert(ab: A with B): A = ab
                                      ^

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions