Skip to content

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

Merged
merged 25 commits into from
May 26, 2017

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 22, 2017

No description provided.

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
Copy link
Contributor

@japgolly japgolly May 22, 2017

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?

Copy link
Contributor Author

@odersky odersky May 22, 2017

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.

@smarter
Copy link
Member

smarter commented May 22, 2017

How is the better type inference for new commit related to the rest? Could we get a testcase for it?

@odersky odersky force-pushed the add-reference-1 branch 3 times, most recently from 2d8388c to 9c91536 Compare May 22, 2017 17:21

```scala
enum Option[+T] {
case Some[T](x: T) extends Option[T]
Copy link
Contributor

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
Copy link
Contributor

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

@odersky odersky force-pushed the add-reference-1 branch from c38cd2c to 1f314e1 Compare May 23, 2017 09:10
```

Note that the parent type of `None` is inferred as
`List[Nothing]`. Generally, all covariant type parameters of the enum
Copy link

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].

@odersky
Copy link
Contributor Author

odersky commented May 26, 2017

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.

@felixmulder
Copy link
Contributor

I'll have a look at this after dinner, amend any changes myself then merge it. Sounds good?

odersky added 16 commits May 26, 2017 20:59
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
@felixmulder felixmulder merged commit 58a4cc3 into scala:master May 26, 2017
@felixmulder
Copy link
Contributor

Silence => agreement => merge! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants