Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Make app types have the correct variance #143

wants to merge 16 commits into from

3 participants

Eric Dobson Eli Barzilay Sam Tobin-Hochstadt
Eric Dobson

This is a large change so that covariant structures work correctly.

The changes:

  • Based on the earlier struct work I did for contracts, because that fixed some bugs in TR's debug contracts.
  • Revamp how tc/struct works so that registering the struct-type is separate from registering the bindings of the struct. This is needed so that the variances of struct types can be computed before the bindings are created, as they need to know if the struct is covariant in all of its arguments.
  • Revamp how free-vars work. They used to be a hash mapping Symbol/Number to Variance. They are now a more complicated data type that reference a global table for when polymorphic structs are instantiated.
  • Change the global table from all covariant (the old way), to the least fixed point of calculating the variance with the table starting at all constant.

Again some tests are failing because of pr13090.

Eli Barzilay

A quick reminder (since we just had a huge bunch of tiny commits for the frtime work): it's better to edit the commits to make them more useful for people who would look at the changes later rather than be a true reflection of how your worked them in. I'm specifically suspicious about commits like "WIP" and "More foo work" which are almost always snapshots of your own progress that are later not going to be useful. (By "edit" I mean what you get with an interactive rebase.)

Sam Tobin-Hochstadt

Does this depend on pull request #139? I ask because it regresses fail/cnt-struct-err.rkt, which is about the contracts generated for struct accessors. Unfortunately, this PR doesn't apply cleanly on top of 139, but I'm working on merging that now.

Sam Tobin-Hochstadt

Oh, silly me. This includes #139.

Sam Tobin-Hochstadt

I think I know what's wrong here. The tc-toplevel traversal no longer records struct procedures as being defined in this module, so it doesn't think it needs to put contracts on them when exported. This should be easy to fix.

Sam Tobin-Hochstadt

Ok, I think I have a fix.

Sam Tobin-Hochstadt

This is now merged, and can be closed.

Eli Barzilay elibarzilay closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.