Conversation
Signed-off-by: Shaw Summa <shawsumma@gmail.com>
Signed-off-by: Shaw Summa <shawsumma@gmail.com>
Signed-off-by: Shaw Summa <shawsumma@gmail.com>
Signed-off-by: Shaw Summa <shawsumma@gmail.com>
Signed-off-by: Shaw Summa <shawsumma@gmail.com>
Signed-off-by: Shaw Summa <shawsumma@gmail.com>
|
Could you add to functional-test-suite/src/commonMain/resources/types/float/ops/ ? That'd make sure the corner cases are exercised for all backends. |
|
Worth noting that in theory this solves #373 in theory and maybe should add a specific test there. Leaving this as a note so its linked in GH history. |
tjpalmer
left a comment
There was a problem hiding this comment.
Some of these changes are good, some are meh, some are bad, and some I still haven't looked at enough.
If you have different opinions on any, let me know.
Minimally, this maybe can serve as an example of why not to just do everything that AI says. Which should help for some talking points of why Temper still matters.
| var abs = absTol ?? 0.0; | ||
| var margin = Math.Max(Math.Max(Math.Abs(x), Math.Abs(y)) * rel, abs); | ||
| return Math.Abs(x - y) < margin; | ||
| return Math.Abs(x - y) <= margin; |
There was a problem hiding this comment.
This does match Python's math.isclose better. I'll plan to see if everything else also gets updated in this pr.
| : trimmed == "-Infinity" | ||
| ? double.NegativeInfinity | ||
| : double.Parse(s); | ||
| : double.Parse(trimmed); |
There was a problem hiding this comment.
In Remarks here, it says that double.Parse allows for surrounding whitespace, so it doesn't matter much whether s or trimmed goes in. Maybe worth a comment either way, and maybe trimmed is less surprising. So probably an ok change to make, even if s also works.
| { | ||
| count += 1; | ||
| if (i + 1 < right) | ||
| if (i + 1 < limit) |
There was a problem hiding this comment.
Because the loop prevents i from going past limit, either works fine here, so again, a needless change but also not a breaking one. And maybe limit is less surprising to some people.
| { | ||
| return -1; | ||
| return i; | ||
| } |
There was a problem hiding this comment.
I personally feel a lot better always using -1 for no string index rather than arbitrary negative values. Is there a good reason for this change that I'm missing? If not, I'd like to revert this.
There was a problem hiding this comment.
I agree with Tom on this.
| } | ||
| const margin = Math.max(Math.max(Math.abs(x), Math.abs(y)) * relTol, absTol); | ||
| return Math.abs(x - y) < margin; | ||
| return Math.abs(x - y) <= margin; |
There was a problem hiding this comment.
So we've updated cs and js so far.
| val calleeTree = callToInline.definition | ||
| val formalNameToArg = callToInline.formalNameToFunArg | ||
| val thisBindings = callToInline.thisTypeBindings | ||
| callToInline.thisTypeBindings |
There was a problem hiding this comment.
This looks like good cleanup at a glance.
| else -> type | ||
| } | ||
| is OrType -> type.members.firstNotNullOf { findNominal(it) } | ||
| is OrType -> type.members.firstNotNullOfOrNull { findNominal(it) } |
There was a problem hiding this comment.
I haven't analyzed to know if this is a good change or not.
| // larger shift or comparison operator, or close tag start marker. | ||
| val before = text[end - 1] | ||
| val after = if (end + 1 < limit) { text[end - 1] } else { '\u0000' } | ||
| val after = if (end + 1 < limit) { text[end + 1] } else { '\u0000' } |
There was a problem hiding this comment.
The old code looks sus, but I don't know why it wouldn't have triggered problems. No test changes from this?
There was a problem hiding this comment.
Nope, no changes, it's one of those "how did it ever work?!" things.
result-helpers/src/commonMain/kotlin/lang/temper/result/junit/JUnitResultParser.kt
Outdated
Show resolved
Hide resolved
| fun append(str: String) { buffer.append(str) } | ||
|
|
||
| @Synchronized | ||
| override fun toString(): String = "$buffer" |
There was a problem hiding this comment.
Again, some analysis here would be good, which I haven't done right now.
There was a problem hiding this comment.
It makes sure the buffer is never read at the same the above append is happening, as that would be bad and give you a toString() that never actually existed.
There was a problem hiding this comment.
It makes sure the buffer is never read at the same the above append is happening, as that would be bad and give you a toString() that never actually existed.
I guess the question is if it's ever used from multithreaded contexts. I still haven't looked, though.
There was a problem hiding this comment.
For the time being it feels like it could be, as the @Synchronized on the other method is preexisting. If it weren't used multithreaded then both should be removed.
Signed-off-by: Shaw Summa <shawsumma@gmail.com>
Maybe a corner case test for |
Signed-off-by: Tom <tom@contextfree.info>
|
|
||
| function temper.string_indexof(str, target, i) | ||
| return string.find(str, target, i, true) or 0 | ||
| return string.find(str, target, i, true) or -1 |
There was a problem hiding this comment.
For lua, I think we're using 0 as no string index, since indices start at 1?
There was a problem hiding this comment.
I liked having it be -1 everywhere, tho maybe this needs more thought
There was a problem hiding this comment.
Does this affect == with NoStringIndex
| TmpLOperator.AmpAmp -> TODO() // RustOperator.LogicalAnd | ||
| TmpLOperator.BarBar -> TODO() // RustOperator.LogicalOr | ||
| TmpLOperator.AmpAmp -> RustOperator.LogicalAnd | ||
| TmpLOperator.BarBar -> RustOperator.LogicalOr |
There was a problem hiding this comment.
I see here's where they were being ignored before. Looks like we don't actually translate to using these. Instead we assign bool values from if/else sequences. But probably good to implement these anyway, just in case, and even if not easy to test, the implementations look ok.
I used the AI to identify and fix small problems in the backends, mostly focusing on correctness, but also doing some inlining.