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.

def in structural type is rejected, but val is accepted

See original GitHub issue
object StructuralTypes {
  type A = { def foo: Int }
  type B = { val foo: Int }
}

dotty rejects this example:

[error] /home/sam/Documents/git/scalameta/tutorial/src/main/resources/StructuralTypes.scala:2: error: refinement method foo without matching type in parent Object
[error]   type A = { def foo: Int }
[error]                  ^
[error] one error found

scalac accepts it, and I guess dotty should as well?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
smartercommented, Aug 26, 2016

I don’t think that the use of structural types here is a good idea, you shouldn’t call close on something without knowing the semantics of close for that particular thing, java.io.Closeable documents the semantics of its close method and if scala.io.Source respects them then it should implement java.io.Closeable.

0reactions
smartercommented, Jan 11, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Promise.reject() - JavaScript - MDN Web Docs
The Promise.reject() method returns a Promise object that is rejected with a given reason.
Read more >
Type Constraints - Configuration Language | Terraform
A structural type allows multiple values of several distinct types to be grouped together as a single value. Structural types require a schema...
Read more >
ACH Payment Reject Reason Codes and Descriptions
Account number structure is valid and passes editing process, but does not correspond to an individual or is not an open account.
Read more >
Reject <3> message – FIX 4.4 – FIX Dictionary - OnixS
The Reject <3> message should be issued when a message is received but cannot be properly processed due to a session-level rule violation....
Read more >
ENTRY SUMMARY ACCEPTANCE AND REJECTION POLICY
Errors that cause rejection of non-ABI entry summaries after collection, but before summary processing in ACS. (unless no collection is made), include: •...
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