Closed OceanOak closed 7 months ago
Questions:
writtenTypesToProgramTypes.dark
, or is the approach implemented in this PR acceptable? module InfixFnName =
let toPT (infix: WrittenTypes.InfixOperator) : ProgramTypes.InfixFnName =
match infix with
| ArithmeticPlus -> ProgramTypes.InfixFnName.ArithmeticPlus
| ArithmeticMinus -> ProgramTypes.InfixFnName.ArithmeticMinus
| ArithmeticMultiply -> ProgramTypes.InfixFnName.ArithmeticMultiply
| ArithmeticDivide -> ProgramTypes.InfixFnName.ArithmeticDivide
| ArithmeticModulo -> ProgramTypes.InfixFnName.ArithmeticModulo
| ArithmeticPower -> ProgramTypes.InfixFnName.ArithmeticPower
| ComparisonGreaterThan -> ProgramTypes.InfixFnName.ComparisonGreaterThan
| ComparisonGreaterThanOrEqual ->
ProgramTypes.InfixFnName.ComparisonGreaterThanOrEqual
| ComparisonLessThan -> ProgramTypes.InfixFnName.ComparisonLessThan
| ComparisonLessThanOrEqual ->
ProgramTypes.InfixFnName.ComparisonLessThanOrEqual
| ComparisonEqual -> ProgramTypes.InfixFnName.ComparisonEquals
| ComparisonNotEqual -> ProgramTypes.InfixFnName.ComparisonNotEquals
| StringConcat -> ProgramTypes.InfixFnName.StringConcat
module BinaryOperation =
let toPT
(binop: WrittenTypes.BinaryOperator)
: ProgramTypes.BinaryOperation =
match binop with
| BinOpAnd -> ProgramTypes.BinaryOperation.BinOpAnd
| BinOpOr -> ProgramTypes.BinaryOperation.BinOpOr
tests/corpus
, should we include tests similar to the following, or should we limit it to testing aspects like precedence?
==================
comparison operator ==
==================
a == b
(source_file (expression (infix_operation (expression (variable_identifier)) (operator) (expression (variable_identifier)) ) ) )
a ^ b
(source_file (expression (infix_operation (expression (variable_identifier)) (operator) (expression (variable_identifier)) ) ) )
Questions:
- Is it worth adding something like the following to
writtenTypesToProgramTypes.dark
, or is the approach implemented in this PR acceptable?
I think this it'd be worth refactoring that fn out, yeah
- In
tests/corpus
, should we include tests similar to the following, or should we limit it to testing aspects like precedence?
Hm maybe I'm missing why you'd question these tests -- they seem useful to me. We don't have that many operators, so a handful of tests for each seems OK. The tree-sitter corpus tests run super fast, anyway.
Changelog:
5321