Skip to content

Ycheck that all methods have method type #1205

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 1 commit into from
Apr 18, 2016

Conversation

liufengyun
Copy link
Contributor

Fix #1046 . Please review @DarkDimius .

@odersky
Copy link
Contributor

odersky commented Apr 8, 2016

Why does this fail?

@liufengyun
Copy link
Contributor Author

Some tests failed related to the tree checking in this commit. I'll investigate. Most likely I missed some valid types here.

@@ -237,6 +237,14 @@ class TreeChecker extends Phase with SymTransformer {
tree
}

/** Check that all methods have either MethodicType or PolyType(MethodicType) */
def isMethodType(pt: Type)(implicit ctx: Context): Boolean = pt match {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing tests suggest that you may be missing AnnotatedTypes here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DarkDimius , AnnotatedType is indeed missing here. But there's something more related to default parameters.

Following generated function for default parameters

    def copy$default$1[a]: a @uncheckedVariance =
      Some.this.x: a @uncheckedVariance

gets following type:

PolyType(List(a), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,scala)),Nothing), TypeRef(ThisType(TypeRef(NoPrefix,scala)),Any))), AnnotatedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,<empty>)),Some)),Some$$a),ConcreteAnnotation(Apply(Select(New(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,unchecked)),uncheckedVariance)]),<init>),List()))))

Is it valid for methods of default parameters to take a non-method type?

@liufengyun
Copy link
Contributor Author

retest this please

@DarkDimius
Copy link
Contributor

LGTM

@DarkDimius DarkDimius merged commit 8c9a3f7 into scala:master Apr 18, 2016
OlivierBlanvillain pushed a commit to OlivierBlanvillain/dotty that referenced this pull request Dec 12, 2016
@allanrenucci allanrenucci deleted the method-check branch December 14, 2017 19:23
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.

4 participants