commit | 113c852f414e64cec7f9a852d2e265a86887b168 | [log] [tgz] |
---|---|---|
author | Michal Terepeta <michal.terepeta@gmail.com> | Thu Nov 18 09:41:57 2021 +0100 |
committer | Copybara-Service <copybara-worker@google.com> | Thu Nov 18 00:46:25 2021 -0800 |
tree | 794dab6fff1154356eb147af61720d8f25a957f6 | |
parent | 076698182de65526ebf2b5c10c3e98bf1ad65c3d [diff] |
[mlir][Python] Fix generation of accessors for Optional Previously, in case there was only one `Optional` operand/result within the list, we would always return `None` from the accessor, e.g., for a single optional result we would generate: ``` return self.operation.results[0] if len(self.operation.results) > 1 else None ``` But what we really want is to return `None` only if the length of `results` is smaller than the total number of element groups (i.e., the optional operand/result is in fact missing). This commit also renames a few local variables in the generator to make the distinction between `isVariadic()` and `isVariableLength()` a bit more clear. Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D113855 GitOrigin-RevId: 54c99842079997b0fe208acdab01e540c0d81b51
See https://mlir.llvm.org/ for more information.