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

Fix problems with TypeVars in intersection and type_match_ #11194

Merged
merged 3 commits into from
May 22, 2015

Conversation

timholy
Copy link
Member

@timholy timholy commented May 8, 2015

Fixes #11136. Don't merge until @JeffBezanson gets enough free time to look this over.

@timholy timholy changed the title Add constraint check on b in intersect_typevar Fix problems with TypeVars in intersection and type_match_ May 13, 2015
@timholy
Copy link
Member Author

timholy commented May 13, 2015

The second commit fixes #8652

@timholy
Copy link
Member Author

timholy commented May 13, 2015

...whoops, no it doesn't (or rather, it breaks other stuff). It made it through test-core, so I thought I was good.

I'll discuss more in #8652.

@timholy timholy force-pushed the teh/tvar_intersect branch from deb0fb2 to 2e26314 Compare May 13, 2015 16:43
@timholy
Copy link
Member Author

timholy commented May 13, 2015

OK, this one should work (it passes locally). Interestingly, it also fixes #8045.

@timholy
Copy link
Member Author

timholy commented May 13, 2015

Hmm, the PR (not the push) has now failed twice on the repl test with an unknown function segfault, only on 32-bit. But the push and AppVeyor give this a pass on 32-bit, so I'm guessing it's OK? I'm trying once more.

@mbauman
Copy link
Member

mbauman commented May 13, 2015

It is possible that there's a difference — the PR build merges the branch into master. You could also try rebasing to see if the push then fails, too.

@timholy
Copy link
Member Author

timholy commented May 13, 2015

I just did an up-to-the-minute rebase, and it passed locally (but this was 64-bit, which also passed on Travis).

@timholy
Copy link
Member Author

timholy commented May 16, 2015

The CI problems seem to have been fixed. Nice!

@timholy
Copy link
Member Author

timholy commented May 21, 2015

Of my various open PRs, now that Jeff seems back (already!) I'm going to bump this particular one. It's short, I think it's one of the last barriers to merging static compilation, and Jeff seems likely to be the only suitable reviewer.

@timholy timholy force-pushed the teh/tvar_intersect branch from 57a47b3 to f9d0d83 Compare May 21, 2015 22:22
@timholy
Copy link
Member Author

timholy commented May 21, 2015

Hah, but I just discovered that a small addition also fixes #11367.

@Keno
Copy link
Member

Keno commented May 21, 2015

Thanks @timholy, amazing work, as always!

if (jl_is_typevar(b)) {
for(i=0; i < penv->n; i+=2) {
if (penv->data[i] == b && !jl_is_typevar(penv->data[i+1])) {
if (jl_types_equal((jl_value_t*)a, penv->data[i+1])) {
Copy link
Member

Choose a reason for hiding this comment

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

This seems very odd to me, since a is a typevar. I would think jl_types_equal would always return false in this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, it probably can be deleted. I'll check it out.

@JeffBezanson
Copy link
Member

Putting us all to shame --- just try to find a neuroscientist who knows as much about type systems! :)

@timholy
Copy link
Member Author

timholy commented May 22, 2015

I'm just trying to keep up with @simonster in doing our clan proud.

Besides, #11242 was type-system boot camp, in every respect except shaving my head (which is good, since there is so little to shave).

timholy added 3 commits May 22, 2015 16:29
…8652)

In jl_args_morespecific(a,b), one of the important tests is to call
type_match_(b,a), essentially reasoning that if b <: a then a cannot
be more specific than b. The problem is that this test can fail for
an independent reason, like invariance. This takes the drastic step
of keeping invariance=false for the type_match_ check in
jl_args_morespecific. Surprisingly, this doesn't appear to break anything.
@timholy timholy force-pushed the teh/tvar_intersect branch from f9d0d83 to 65cc7f3 Compare May 22, 2015 21:31
@timholy
Copy link
Member Author

timholy commented May 22, 2015

Right as usual, Jeff. And thanks for the speedy review!

timholy added a commit that referenced this pull request May 22, 2015
Fix problems with TypeVars in intersection and type_match_
@timholy timholy merged commit 7ddc684 into master May 22, 2015
@timholy timholy deleted the teh/tvar_intersect branch May 22, 2015 23:28
@carnaval
Copy link
Contributor

👏

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.

Type constraint ignored by typeintersect and function ambiguity check
5 participants