question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dotty infers inexpressible type

See original GitHub issue

Given:

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:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
smartercommented, May 30, 2017

I don’t know of another way in which a mere mortal can currently inspect an inferred type in Dotty

Try compiling with -Xprint:frontend.

0reactions
Atrycommented, Jan 24, 2018

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found