<commit_before>// misc.cpp
// Copyright (c) 2017, <EMAIL>
// Licensed under the Apache License Version 2.0.

#include "pts.h"
#include "ast.h"
#include "ir/type.h"
#include "typecheck.h"

#include "errors.h"
#include "polymorph.h"

namespace sst
{
	namespace poly
	{
		namespace internal
		{
			static int polySessionId = 0;
			int getNextSessionId()
			{
				return polySessionId++;
			}

			fir::Type* mergeNumberTypes(fir::Type* a, fir::Type* b)
			{
				if(a->isConstantNumberType() && b->isConstantNumberType())
				{
					return fir::unifyConstantTypes(a->toConstantNumberType(), b->toConstantNumberType());
				}
				else if(a->isFloatingPointType() && b->isIntegerType())
				{
					return a;
				}
				else if(a->isIntegerType() && b->isFloatingPointType())
				{
					return b;
				}
				else
				{
					if(a->getBitWidth() > b->getBitWidth())
						return a;

					else
						return b;
				}
			}


			fir::Type* convertPtsType(TypecheckState* fs, const ProblemSpace_t& problems, pts::Type* input, int polysession)
			{
				fir::Type* fty = 0;
				auto [ ty, trfs ] = decomposeIntoTransforms(input);

				if(ty->isNamedType())
				{
					fty = fs->convertParserTypeToFIR(ty, true);
					if(!fty && (std::find_if(problems.begin(), problems.end(), [&ty](const auto& a) -> bool {
							return ty->toNamedType()->name == a.first;
						}) != problems.end()))<commit_msg>apparently clang has an issue with capturing structured binding names in lambdas<commit_after>// misc.cpp
// Copyright (c) 2017, <EMAIL>
// Licensed under the Apache License Version 2.0.

#include "pts.h"
#include "ast.h"
#include "ir/type.h"
#include "typecheck.h"

#include "errors.h"
#include "polymorph.h"

namespace sst
{
	namespace poly
	{
		namespace internal
		{
			static int polySessionId = 0;
			int getNextSessionId()
			{
				return polySessionId++;
			}

			fir::Type* mergeNumberTypes(fir::Type* a, fir::Type* b)
			{
				if(a->isConstantNumberType() && b->isConstantNumberType())
				{
					return fir::unifyConstantTypes(a->toConstantNumberType(), b->toConstantNumberType());
				}
				else if(a->isFloatingPointType() && b->isIntegerType())
				{
					return a;
				}
				else if(a->isIntegerType() && b->isFloatingPointType())
				{
					return b;
				}
				else
				{
					if(a->getBitWidth() > b->getBitWidth())
						return a;

					else
						return b;
				}
			}


			fir::Type* convertPtsType(TypecheckState* fs, const ProblemSpace_t& problems, pts::Type* input, int polysession)
			{
				fir::Type* fty = 0;
				auto [ _ty, trfs ] = decomposeIntoTransforms(input);
				pts::Type* ty = _ty;

				if(ty->isNamedType())
				{
					fty = fs->convertParserTypeToFIR(ty, true);
					if(!fty && (std::find_if(problems.begin(), problems.end(), [ty](const auto& a) -> bool {
							return ty->toNamedType()->name == a.first;
						}) != problems.end()))
{'fraction_non_alphanumeric': 0.15941011235955055, 'fraction_numerical': 0.0056179775280898875, 'mean_word_length': 3.105187319884726, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4993555', 'n_tokens_mistral': 1267, 'n_tokens_neox': 995, 'n_words': 211}