Open
Description
Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_102).
Type in expressions for evaluation. Or try :help.
scala> trait InvariantContainer[Value0] {
| type Value = Value0
| }
defined trait InvariantContainer
scala> type ValueOf[Container <: InvariantContainer[_]] = container.Value forSome { val container: Container }
warning: there was one feature warning; for details, enable `:setting -feature' or `:replay -feature'
defined type alias ValueOf
scala> def intIsValueOfIntContainer(x: Int): ValueOf[InvariantContainer[Int]] = x
intIsValueOfIntContainer: (x: Int)ValueOf[InvariantContainer[Int]]
scala> type OptionValueOf[Container <: InvariantContainer[_]] = Option[ValueOf[Container]]
defined type alias OptionValueOf
scala> def optionIntIsOptionValueOfIntContainer(x: Option[Int]): OptionValueOf[InvariantContainer[Int]] = x
optionIntIsOptionValueOfIntContainer: (x: Option[Int])OptionValueOf[InvariantContainer[Int]]
scala> type InlineOptionValueOf[Container <: InvariantContainer[_]] = Option[container.Value forSome { val container: Container }]
warning: there was one feature warning; for details, enable `:setting -feature' or `:replay -feature'
defined type alias InlineOptionValueOf
scala> def optionIntIsInlineOptionValueOfIntContainer(x: Option[Int]): InlineOptionValueOf[InvariantContainer[Int]] = x
<console>:13: error: type mismatch;
found : Option[Int]
required: InlineOptionValueOf[InvariantContainer[Int]]
(which expands to) Option[Int[]]
def optionIntIsInlineOptionValueOfIntContainer(x: Option[Int]): InlineOptionValueOf[InvariantContainer[Int]] = x
^
optionIntIsInlineOptionValueOfIntContainer
should not error because InlineOptionValueOf
is simply an inline version of OptionValueOf
. I expect InlineOptionValueOf
behaves the same as OptionValueOf
.