Skip to content

Generate structs for tuples#9

Merged
ghostbuster91 merged 3 commits into
mainfrom
tupleStruct
May 13, 2025
Merged

Generate structs for tuples#9
ghostbuster91 merged 3 commits into
mainfrom
tupleStruct

Conversation

@ghostbuster91

Copy link
Copy Markdown
Contributor

this closes #6

@ghostbuster91 ghostbuster91 requested a review from kubukoz May 13, 2025 09:20
case Type.MapType(k, v) => s"MapOf${extractTypeName(k)}To${extractTypeName(v)}"
case Type.StringLiteralType(_) | Type.BooleanLiteralType(_) => "Literal"
case Type.StructureLiteralType(StructureLiteral(props, _)) => s"Literal${MurmurHash3.indexedSeqHash(props, 0)}"
case Type.StructureLiteralType(StructureLiteral(props, _)) => s"Literal${Math.abs(MurmurHash3.indexedSeqHash(props, 0))}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

negative hashes are my passion

tupleBulider.addMember(
MemberShape
.builder()
.id(tupleId.withMember(s"_$i"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we'll want some meaningful names for these. Probably using a mechanism similar to neandertech/langoustine#204

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

e.g. ParameterInformation will have sth like inclusiveStart, exclusiveEnd

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

but I'm happy to make it a ticket

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah let's leave it for later

tupleId = ShapeId.fromParts(namespace, s"TupleOf${items_.map(_.getName).mkString}")
result <- State[Set[Shape], ShapeId] { shapes =>
val listShape = ListShape
val tupleBulider = StructureShape

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo tupleBulider

@ghostbuster91 ghostbuster91 merged commit a7fd0ac into main May 13, 2025
@ghostbuster91 ghostbuster91 deleted the tupleStruct branch May 13, 2025 17:35
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.

Tuple shapes

2 participants