Cannot abstract over erased classes
See original GitHub issueCompiler version
3.0.1
Minimized example
import language.experimental.erasedDefinitions
erased class Capability
def f(using Capability): Int = 1
def g[C <: Capability](using C): Int = 1
Output
6 |def g[C <: Capability](using C): Int = 1
| ^
|illegal reference to erased trait Capability in definition that is not itself erased
Expectation
We should be able to abstract over erased classes.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Can't override operator delete/new from pure abstract class in ...
I want to override new and delete operators of a class to make it use my memory pool. It works with normal classes...
Read more >Cannot instantiate abstract class or interface exception
Hi, I am using NHibernate version 2.0.1. I have an User class which has a collection of 'Role'. Role is an abstract class...
Read more >Incorrect "Creating an instance of the Abstract class is not ...
Hi! Trying to instantiate a derived class, query_dev, whose classdef has not a single occurrence of the word Abstract, I get the complaint...
Read more >Abstract Classes - Taylorial.com
We can declare references from an abstract class. We cannot create objects from an abstract class. In Java, we can only inherit from...
Read more >Classes - JavaScript - MDN Web Docs
Classes in JS are built on prototypes but also have some syntax and semantics ... their class and cannot be called through a...
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 Free
Top 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
Does it work with
(using erased C)
?So that does not cover the example, since there
C
is neither aliased, nor refined nor instantiated. Should it also work? I am not sure about that yet. Maybe better be conservative at first?If we wanted to generalize it, what would the right rule be? In particular considering that bounds can be unions or intersections?