Skip to content

Instantly share code, notes, and snippets.

@travisbrown
Created July 10, 2013 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save travisbrown/5962424 to your computer and use it in GitHub Desktop.
Save travisbrown/5962424 to your computer and use it in GitHub Desktop.
scala> trait Foo[A] { def bar[B](b: B): Foo[A with B] }
defined trait Foo
scala> def baz[A](foo: Foo[A]) = foo bar 1
baz: [A](foo: Foo[A])Foo[A with Int]
scala> def baz[A](foo: Foo[A]): Foo[A with Int] = foo bar 1
<console>:8: error: type mismatch;
found : Int(1)
required: Nothing
def baz[A](foo: Foo[A]): Foo[A with Int] = foo bar 1
^
@travisbrown
Copy link
Author

Reduced form of this Stack Overflow question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment