Dotty infers inexpressible type
See original GitHub issueGiven:
trait Bippy
trait Boppy extends Bippy
trait Foo[B <: Bippy, C]
def bar[B <: Bippy, C](u1: Foo[_ <: B, C]): Foo[B, C] = ???
def foo: Foo[_ <: Boppy, _] = null
Evaluating the following in the REPL yields a method with an inferred type that cannot be expressed in user code.
scala> def baz = bar(foo)
def baz: Foo[Boppy, foo.C]
foo
is not a stable value.
scala> def baz: Foo[Boppy, foo.C] = ???
-- Error: <console>:8:20 -------------------------------------------------------
8 |def baz: Foo[Boppy, foo.C] = ???
| ^^^
| => Foo[_ <: Boppy, _](foo) is not stable
If I make foo
a val
, baz
gets the same type but it is still not expressible.
scala> def baz: Foo[Boppy, foo.C] = ???
-- Error: <console>:8:24 -------------------------------------------------------
8 |def baz: Foo[Boppy, foo.C] = ???
| ^^^^^
|type C in class Foo cannot be accessed as a member of Foo[_ <: Boppy, _](foo) from module class $iw$.
I don’t know if this is caused by the REPL itself, because I don’t know of another way in which a mere mortal can currently inspect an inferred type in Dotty.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
snickersnee | Word Nerdery
'Want' implies a 'wishing to have' due to a 'lack of something'. ... I like short, offensive words such as potty, dopey, dotty,...
Read more >Formation Of Character - Charlotte Mason Homeschool Series
| AMBLESIDEONLINE | CM SERIES HOME | CONCISE SUMMARIES | MODERN ENGLISH PARAPHRASE |. This edition of the Charlotte Mason Series, typed by...
Read more >Reid's Reader – A Blog of Book Reviews and Comment.
Quite late in the novel (pp.476-482), it is clear that while “The Unspeakable” may be a demonic curse, it also refers to homosexual...
Read more >синонимы - LiveJournal
Types of Connotations 4) The Dominant Synonym 5) Euphemisms 1. ... Shamble implies dragging one's feet while walking; a physical effort is also...
Read more >The Hollow of Her Hand, by George Barr McCutcheon
Mrs. Wrandall sat above her, looking down, held mute by warring emotions. The impossible had come to pass. The girl for whom the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try compiling with
-Xprint:frontend
.Why not simply allow a type that is path-dependent to a method?
Since the Dotty’s sanity check have been moved to the point of class instantiation, is stability check still necessary?