Skip to content

void object fields are now ignored by codegen and fields/fieldPairs iterator#10144

Merged
Araq merged 6 commits intonim-lang:develfrom
nc-x:invalid-void
Jan 10, 2019
Merged

void object fields are now ignored by codegen and fields/fieldPairs iterator#10144
Araq merged 6 commits intonim-lang:develfrom
nc-x:invalid-void

Conversation

@nc-x
Copy link
Copy Markdown
Contributor

@nc-x nc-x commented Dec 31, 2018

Closes #3734

@nc-x
Copy link
Copy Markdown
Contributor Author

nc-x commented Dec 31, 2018

Fails due to 1fb5dd2

@Araq
Copy link
Copy Markdown
Member

Araq commented Dec 31, 2018

The void type for object fields is allowed though and the codegens should ignore these fields. I think.

@nc-x nc-x changed the title void type is invalid for object members codegen (and $) now ignore void type for object fields Jan 1, 2019
@nc-x
Copy link
Copy Markdown
Contributor Author

nc-x commented Jan 1, 2019

cc @Araq

@Araq
Copy link
Copy Markdown
Member

Araq commented Jan 1, 2019

Thanks but your change in system.nim made me reconsider. It's yet another special case that gets exposed to every piece of code that uses field iteration. --> Better not allow it and require code to use the more explicit when T isnot void variant for the outlined use case "Table[K, void] is Set[K]".

Alternatively the fields iterators should ignore void fields automatically.

@nc-x
Copy link
Copy Markdown
Contributor Author

nc-x commented Jan 1, 2019

Alternatively the fields iterators should ignore void fields automatically.

Done.

@nc-x nc-x closed this Jan 1, 2019
@nc-x nc-x reopened this Jan 1, 2019
@nc-x nc-x changed the title codegen (and $) now ignore void type for object fields void object fields are now ignored by codegen and fields/fieldPairs iterator Jan 1, 2019
@nc-x
Copy link
Copy Markdown
Contributor Author

nc-x commented Jan 8, 2019

cc @Araq

@krux02
Copy link
Copy Markdown
Contributor

krux02 commented Jan 8, 2019

interesting that void object fields are even allowed. But apart from that, I am ok with these changes.

@Araq
Copy link
Copy Markdown
Member

Araq commented Jan 8, 2019

You should use isEmptyType instead of testing for tyVoid directly.

@nc-x
Copy link
Copy Markdown
Contributor Author

nc-x commented Jan 9, 2019

Done.

@Araq Araq merged commit d998cb5 into nim-lang:devel Jan 10, 2019
@nc-x nc-x deleted the invalid-void branch January 10, 2019 12:08
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.

3 participants