Skip to content
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

Reify type refs in inherited method bodies #1722

Merged
merged 1 commit into from
Mar 18, 2017
Merged

Conversation

sylvanc
Copy link
Contributor

@sylvanc sylvanc commented Mar 18, 2017

Previously, a trait that had a method body that used a typearg as
a class to call a constructor on would fail when the method body
was inherited, as the TK_REFERENCE wasn't reified. Now the
TK_REFERENCE is reified as a TK_TYPEREF.

Previously, a trait that had a method body that used a typearg as
a class to call a constructor on would fail when the method body
was inherited, as the TK_REFERENCE wasn't reified. Now the
TK_REFERENCE is reified as a TK_TYPEREF.
@sylvanc sylvanc added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Mar 18, 2017
@sylvanc sylvanc merged commit e2ea104 into master Mar 18, 2017
ponylang-main added a commit that referenced this pull request Mar 18, 2017
@sylvanc sylvanc deleted the trait-reify-typearg branch March 18, 2017 21:15
@jemc
Copy link
Member

jemc commented Mar 26, 2017

FYI, this PR was the cause of the CI problems with #1715. I'm still trying to figure out how to resolve them.

@jemc
Copy link
Member

jemc commented Mar 26, 2017

Okay, I figured out a way to deal with this change in #1715, but I'm now getting a compiler error with the test case you added that I think is legitimate:

trait T1
 new val create()

trait T2

primitive P is (T1 & T2)

trait T3[A: T1 val]
 fun foo(): A =>
   A

class Baz is T3[(T2 & P)]
 fun bar(): P => foo()
Error:
can't call a constructor on a type intersection: (T2 ref & P val)
   A
   ^

I'm going to replace the (T2 & P) type arg in the test case with just simply P, so that we're not calling a constructor on a type intersection - is that okay?

jemc added a commit that referenced this pull request Mar 26, 2017
@sylvanc
Copy link
Contributor Author

sylvanc commented Mar 27, 2017

Hmm, interesting. This was allowing a constructor call, as it was finding the constructor on P. But we could pass it some (P1 & P2) as a type argument (an unfulfillable type arg!) and it would pick one of the constructors, which is wrong.

So yes, please do make that change! Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants