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

TypeSystem, Add PrimitiveType.String() #694

Merged
merged 9 commits into from
Jul 14, 2023
Merged

Conversation

nnnnblaser
Copy link
Contributor

No description provided.

@@ -37,43 +37,43 @@ func TestTypeStrings(t *testing.T) {

// Predefined types

{skip: true, Output: "any", Type: types.Predefined["any"]},
{skip: false, Output: "any", Type: types.Predefined["any"]},
Copy link
Member

Choose a reason for hiding this comment

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

Please do not set skip to false, but remove it instead:

Suggested change
{skip: false, Output: "any", Type: types.Predefined["any"]},
{Output: "any", Type: types.Predefined["any"]},

Comment on lines 149 to 156
var constraints string
if t.ValueConstraints != nil {
for _, v := range t.ValueConstraints {
constraints = constraints + v.String() + ", "
}
constraints = " (" + strings.Trim(constraints, ", ") + ")"
}
return t.Kind.String() + constraints
Copy link
Member

Choose a reason for hiding this comment

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

Consider using as slice for contraints:

Suggested change
var constraints string
if t.ValueConstraints != nil {
for _, v := range t.ValueConstraints {
constraints = constraints + v.String() + ", "
}
constraints = " (" + strings.Trim(constraints, ", ") + ")"
}
return t.Kind.String() + constraints
if t.ValueConstraints == nil {
return t.Kind.String()
}
var constrains []string
for _, v := range t.ValueConstraints {
constraints = append(constraints, v.String())
}
return fmt.Sprintf("%s (%s)", t.Kind.String(), strings.Join(constraints, ", "))

@5nord 5nord merged commit 580ed6f into nokia:master Jul 14, 2023
1 check passed
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.

2 participants