Skip to content

Instantly share code, notes, and snippets.

@bbarker
Last active December 12, 2021 04:29
Show Gist options
  • Save bbarker/360780ebf24c4648c729a2238bc491ba to your computer and use it in GitHub Desktop.
Save bbarker/360780ebf24c4648c729a2238bc491ba to your computer and use it in GitHub Desktop.
If we explicitly ascribe more precise types for each value, then we run into the same kind of error
val someStuffAny2: List[SomeClass[Any]] =
List(SomeClass("foo"): SomeClass[String], SomeClass(1): SomeClass[Int])
// ❌ Found: Playground.SomeClass[Int]
// Required: Playground.SomeClass[Any]
// ❌ Found: Playground.SomeClass[String]
// Required: Playground.SomeClass[Any]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment