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 for issue #92 #93

Merged
merged 4 commits into from
Sep 3, 2021
Merged

Fix for issue #92 #93

merged 4 commits into from
Sep 3, 2021

Conversation

dlurton
Copy link
Member

@dlurton dlurton commented Sep 1, 2021

Fix for issue #92.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@dlurton dlurton marked this pull request as draft September 1, 2021 23:20
@@ -51,8 +51,7 @@ internal fun TypeUniverse.convertToKTypeUniverse(): KTypeUniverse {
}

private class KTypeDomainConverter(
private val typeDomain: TypeDomain,
private val isTransform: Boolean
Copy link
Member Author

@dlurton dlurton Sep 2, 2021

Choose a reason for hiding this comment

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

isTransform was unused, decided to nix it now since it was convenient.

@@ -62,7 +61,7 @@ private class KTypeDomainConverter(

typeDomain.types.forEach {
when(it) {
DataType.Int, DataType.Symbol, DataType.Ion -> { /* intentionally blank */ }
DataType.Int, DataType.Symbol, DataType.Ion, DataType.Bool -> { /* intentionally blank */ }
Copy link
Member Author

Choose a reason for hiding this comment

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

Also a minor addition that stopped my IDE from complaining about missing a case.

@dlurton dlurton self-assigned this Sep 2, 2021
@dlurton dlurton changed the title Fix for issue #92 (draft) Fix for issue #92 Sep 2, 2021
@dlurton dlurton marked this pull request as ready for review September 2, 2021 00:31
Copy link
Member

@alancai98 alancai98 left a comment

Choose a reason for hiding this comment

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

Have some comments on formatting and naming. Fix looks good otherwise

(sum sum_a
(who)
(cares a::product_to_remove)
(noti (a product_to_remove)))
Copy link
Member

Choose a reason for hiding this comment

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

What is noti used for?

Copy link
Member Author

Choose a reason for hiding this comment

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

noti is a record while cases is a product.

Same thing the other two are: they are just nonsense names.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, the name can still be kind of confusing. Is there any meaning to the name noti?

@@ -7318,10 +7318,12 @@ class DomainA private constructor() {
*/
fun productA(
one: Long,
two: ProductToRemove,
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to this change, but the formatting of permuted domain visitor transforms is slightly off:

open fun transformUnpermutedProduct(node: DomainA.UnpermutedProduct): DomainB.UnpermutedProduct {
        val new_foo = transformUnpermutedProduct_foo(node)
        val new_bar = transformUnpermutedProduct_bar(node)
        val new_metas = transformUnpermutedProduct_metas(node)
        return             DomainB.UnpermutedProduct(
                foo = new_foo,
                bar = new_bar,
                metas = new_metas
            )
    }

Copy link
Member Author

Choose a reason for hiding this comment

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

That's been there for a while. It's also not that important, IMHO, to get generated code to be perfectly formatted.

@@ -129,6 +129,7 @@
(product product_to_remove whatever::symbol)
(record record_to_remove (irrelevant int))
(sum sum_to_remove (doesnt) (matter))
(sum will_be_replaced_with_product (will_be_replaced_with_product_variant t::product_to_remove))
Copy link
Member

Choose a reason for hiding this comment

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

Not too big a fan of this type's name. Could it be renamed to start with product to be more consistent with the preceding types? Something like product_to_be_replaced? Also could remove the "will_be_replaced_with_product_" part before "variant".

Consider adding a comment saying this will be replaced in the permuted domain with another product of the same name.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a sum type that will be replaced with a product.

@dlurton dlurton requested a review from alancai98 September 3, 2021 01:43
Copy link
Member

@alancai98 alancai98 left a comment

Choose a reason for hiding this comment

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

Had a non-blocking nit for the added comment. Also feel that the name noti is kind of confusing unless there's some additional meaning I'm not getting.

(record record_a (one int) (two product_to_remove))
(product product_a
one::int
// This reference to a typed removed in the permuted domain must not cause pig to crash:
Copy link
Member

Choose a reason for hiding this comment

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

(non-blocking) nit: "This reference to a type removed in the..."

Similarly for L150 and L156

(sum sum_a
(who)
(cares a::product_to_remove)
(noti (a product_to_remove)))
Copy link
Member

Choose a reason for hiding this comment

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

Ok, the name can still be kind of confusing. Is there any meaning to the name noti?

@alancai98 alancai98 linked an issue Sep 3, 2021 that may be closed by this pull request
@dlurton dlurton merged commit b4b4d9d into main Sep 3, 2021
@dlurton dlurton deleted the issue-92 branch September 3, 2021 20:34
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.

IllegalStateException under unique circumstance in permuted_domains
2 participants