def in structural type is rejected, but val is accepted
See original GitHub issueobject 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:
- Created 8 years ago
- Comments:7 (6 by maintainers)
Top 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 >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
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 ofclose
for that particular thing,java.io.Closeable
documents the semantics of itsclose
method and ifscala.io.Source
respects them then it should implementjava.io.Closeable
.Closing, see https://github.com/lampepfl/dotty/issues/1886