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 text in C++ default statement #2623

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class CPlusPlusRenderer extends ConvenienceRenderer {
// };
//
// checking to see if the collapse of the variant has
// occured and then doing the isCycleBreakerType check
// occurred and then doing the isCycleBreakerType check
// on the single type the variant would contain seems
// to solve the problem. But does this point to a problem
// with the core library or with the CPlusPlus package
Expand Down Expand Up @@ -916,7 +916,7 @@ export class CPlusPlusRenderer extends ConvenienceRenderer {
if (constraints === undefined) return;
const { minMax, minMaxLength, pattern } = constraints;

// TODO is there a better way to check if property.type is an interger or a number?
// TODO is there a better way to check if property.type is an integer or a number?
const cppType = this.cppType(
property.type,
{
Expand Down Expand Up @@ -1627,7 +1627,9 @@ export class CPlusPlusRenderer extends ConvenienceRenderer {
);
});
this.emitLine(
`default: throw std::runtime_error("Unexpected value in enumeration \\"${enumName}\\": " + std::to_string(static_cast<int>(x)));`
`default: throw std::runtime_error("Unexpected value in enumeration \\"`,
enumName,
`\\": " + std::to_string(static_cast<int>(x)));`
);
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/quicktype-core/src/rewrites/ExpandStrings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export function expandStrings(ctx: RunContext, graph: TypeGraph, inference: Enum
const transformations = mappedStringTypes.transformations;
// FIXME: This is probably wrong, or at least overly conservative. This is for the case
// where some attributes are identity ones, i.e. where we can't merge the primitive types,
// like it happens in the line after the `if`. The case where this occured was with URI
// like it happens in the line after the `if`. The case where this occurred was with URI
// attributes: we had two separate string types with different URI attributes, but because
// both are rewritten via `getPrimitiveType` below without any attributes, they end up
// being the same string type.
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/cplusplus/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ int main(int argc, const char * argv[]) {
std::cerr << "Usage: " << argv[0] << " FILE";
return 1;
}

std::ifstream t(argv[1]);
std::string str((std::istreambuf_iterator<char>(t)),
std::istreambuf_iterator<char>());

TopLevel tl = json::parse(str);
json j2 = tl;

std::cout << j2 << std::endl;

return 0;
Expand Down
Loading