<commit_before>module languages/Java-1.5/expressions/types/conditional

imports
	
	include/Java
	lib/task/-
	lib/types/-
	lib/properties/-
	lib/relations/-
	
	languages/Java-1.5/types/types/primitives
	languages/Java-1.5/types/types/promotion

signatures

	BSC : TypeKind // Byte, Short or Char.
	
relations
	
   Byte()  <is: BSC()
   Short() <is: BSC()
   Char()  <is: BSC()
	
type rules
	
	c@Cond(c, x, y) : ty
	where c : c-ty
	  and c-ty == Boolean() else error "Expected boolean" on c
	  and x : x-ty
	  and y : y-ty
	  and (
		  (
		   	    x-ty == y-ty
		   	and y-ty => ty
		  )
		  or
		  (
		        x-ty <is: Numerical()
		    and y-ty <is: Numerical()
		    and (
				    	(((x-ty == Byte() and y-ty == Short()) or (x-ty == Short() and y-ty == Byte())) and Short() => ty)
				   // or ((x-ty <is: BSC() and y-ty == Int()) and y <representable: x-ty and x-ty => ty) // TODO: only if y-ty is a constant, TODO: value representability.
				   // or ((x-ty == Int() and y-ty <is: BSC()) and x <representable: y-ty and y-ty => ty) // TODO: only if x-ty is a constant, TODO: value representability.
				   or <promote-bin> (x-ty, y-ty) => ty
		    )
		  )
		  or ((x-ty <is: Reference() and y-ty == Null()) and x-ty => ty)
		  or ((x-ty == Null() and y-ty <is: Reference()) and y-ty => ty)
		  or (x-ty <is: Reference() and y-ty <is: Reference() and x-ty <assign-conv: y-ty and y-ty => ty)
	  ) else error "Type mismatch between expressions" on c<commit_msg>Fix conditional expression type rule<commit_after>module languages/Java-1.5/expressions/types/conditional

imports
	
	include/Java
	lib/task/-
	lib/types/-
	lib/properties/-
	lib/relations/-
	
	languages/Java-1.5/types/types/primitives
	languages/Java-1.5/types/types/promotion

signatures

	BSC : TypeKind // Byte, Short or Char.
	
relations
	
   Byte()  <is: BSC()
   Short() <is: BSC()
   Char()  <is: BSC()
	
type rules
	
	term@Cond(c, x, y) : ty
	where c : c-ty
	  and c-ty == Boolean() else error "Expected boolean" on c
	  and x : x-ty
	  and y : y-ty
	  and (
		  (
		   	    x-ty == y-ty
		   	and y-ty => ty
		  )
		  or
		  (
		        x-ty <is: Numerical()
		    and y-ty <is: Numerical()
		    and (
				    	(((x-ty == Byte() and y-ty == Short()) or (x-ty == Short() and y-ty == Byte())) and Short() => ty)
				   // or ((x-ty <is: BSC() and y-ty == Int()) and y <representable: x-ty and x-ty => ty) // TODO: only if y-ty is a constant, TODO: value representability.
				   // or ((x-ty == Int() and y-ty <is: BSC()) and x <representable: y-ty and y-ty => ty) // TODO: only if x-ty is a constant, TODO: value representability.
				   or <promote-bin> (x-ty, y-ty) => ty
		    )
		  )
		  or ((x-ty <is: Reference() and y-ty == Null()) and x-ty => ty)
		  or ((x-ty == Null() and y-ty <is: Reference()) and y-ty => ty)
		  or (x-ty <is: Reference() and y-ty <is: Reference() and x-ty <assign-conv: y-ty and y-ty => ty)
	  ) else error "Type mismatch between expressions" on term
{'fraction_non_alphanumeric': 0.1740602776837115, 'fraction_numerical': 0.004063664070436844, 'mean_word_length': 2.264088397790055, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 21, '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': '531112', 'n_tokens_mistral': 1240, 'n_tokens_neox': 1092, 'n_words': 355}