-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Reference sections for some of the new things in Dotty #2498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
not evaluated at all. | ||
|
||
The synthesized argument for an implicit parameter is backed by a lazy | ||
val, which means that the parameter is evaluated at most once. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's backed by a lazy val would it not be better to call this feature Implicit By-Need Parameters instead? Is there a reason that it's being described as call-by-name instead of call-by-need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's complicated. The lazy val is an internal implementation detail of the synthesized argument. It is not generated at all unless the synthesis is recursive. The parameter itself is by-name, i.e. the argument computation can be invoked multiple times. Later commits have fixed the wording to reflect this.
How is the better type inference for new commit related to the rest? Could we get a testcase for it? |
2d8388c
to
9c91536
Compare
docs/docs/reference/adts.md
Outdated
|
||
```scala | ||
enum Option[+T] { | ||
case Some[T](x: T) extends Option[T] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing covariance
EnumCase ::= `case' (EnumClassDef | ObjectDef | ids) | ||
EnumClassDef ::= id [ClsTpeParamClause | ClsParamClause] | ||
ClsParamClauses TemplateOpt | ||
TemplateStat ::= ... | EnumCaseStat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be TemplateOpt or the above line be TemplateStat
docs/docs/reference/adts.md
Outdated
``` | ||
|
||
Note that the parent type of `None` is inferred as | ||
`List[Nothing]`. Generally, all covariant type parameters of the enum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be Option[Nothing]
.
I think this is ready to go in now. Would be good to have something up on the docsite so we can play with the highlighting and other appearance aspects. |
I'll have a look at this after dinner, amend any changes myself then merge it. Sounds good? |
and fix doc accordingly.
For an expression of the form `new { ... }`, infer the parent type if possible from the expected type. Fallback to `Object` if the expected type is undefined or is illegal for a class parent.
Needed to make run/t6154.scala compile.
The logic for generating the result type of apply was wrong if value parameters were passed to the enum class. Test case in objXfun.scala.
Need to account for the fact that they all compile together
78836c3
to
8013ea4
Compare
Silence => agreement => merge! 🎉 |
No description provided.