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.

NoType when deriving an abstract type

See original GitHub issue

Compiler version

3.1.0

Minimized code

object OpaqueTypes:
  opaque type OpaqueType[A] = List[A]
  object OpaqueType:
    def derived[A]: OpaqueType[A] = Nil

import OpaqueTypes.OpaqueType
case class Boom[A](value: A) derives OpaqueType

Output

-- Error: foo.scala:7:37 -------------------------------------------------------
7 |case class Boom[A](value: A) derives OpaqueType
  |                                     ^^^^^^^^^^
  |                                     <notype> is not a class type
1 error found

Expectation

compiles or provides more a useful error

In case it’s not clear from the code, I’m trying to derive an instance of an opaque type.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bishaboshacommented, Oct 25, 2021

minimised to being a plain abstract type:

object FooModule:
  type Foo[A]
  object Foo:
    def derived[A]: Foo[A] = Nil.asInstanceOf[Foo[A]]

import FooModule.Foo
case class Boom[A](value: A) derives Foo
0reactions
robmwalshcommented, Oct 26, 2021

Thanks for the explanation. This is way above my pay grade so I’ll create a feature request and leave it for more brilliant minds to decide if it’s sound and worth implementing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript Abstract Class
Define an abstract class in Typescript using the abstract keyword. Abstract classes are mainly for inheritance where other classes may derive from them....
Read more >
Abstract Base class in Python
An abstract class is designed only to act as a base class (to be inherited by other classes). It is a design concept...
Read more >
c# - Can't cast derived type to base abstract class with ...
If the concrete classes inherit from a common abstract base class with a type parameter I cannot cast them. The compiler tells me...
Read more >
abstract - C# Reference
A non-abstract class derived from an abstract class must include actual implementations of all inherited abstract methods and accessors.
Read more >
What is the purpose of an abstract class in object-oriented ...
The Person class is too ambiguous in itself, so you make it abstract. Abstract classes can include logic, and enforce subclass (derived objects)...
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