compiler bug with that can cause compilation infinite loop; object is always comparable to self instance or null
This commit is contained in:
parent
bc6613ec01
commit
ce021e85f4
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2025 Sergey S. Chernov real.sergeych@gmail.com
|
* Copyright 2026 Sergey S. Chernov real.sergeych@gmail.com
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -324,15 +324,14 @@ private class Parser(fromPos: Pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
'?' -> {
|
'?' -> {
|
||||||
when (currentChar.also { pos.advance() }) {
|
when (currentChar) {
|
||||||
':' -> Token("??", from, Token.Type.ELVIS)
|
':' -> { pos.advance(); Token("?:", from, Token.Type.ELVIS) }
|
||||||
'?' -> Token("??", from, Token.Type.ELVIS)
|
'?' -> { pos.advance(); Token("??", from, Token.Type.ELVIS) }
|
||||||
'.' -> Token("?.", from, Token.Type.NULL_COALESCE)
|
'.' -> { pos.advance(); Token("?.", from, Token.Type.NULL_COALESCE) }
|
||||||
'[' -> Token("?(", from, Token.Type.NULL_COALESCE_INDEX)
|
'[' -> { pos.advance(); Token("?[", from, Token.Type.NULL_COALESCE_INDEX) }
|
||||||
'(' -> Token("?(", from, Token.Type.NULL_COALESCE_INVOKE)
|
'(' -> { pos.advance(); Token("?(", from, Token.Type.NULL_COALESCE_INVOKE) }
|
||||||
'{' -> Token("?{", from, Token.Type.NULL_COALESCE_BLOCKINVOKE)
|
'{' -> { pos.advance(); Token("?{", from, Token.Type.NULL_COALESCE_BLOCKINVOKE) }
|
||||||
else -> {
|
else -> {
|
||||||
pos.back()
|
|
||||||
Token("?", from, Token.Type.QUESTION)
|
Token("?", from, Token.Type.QUESTION)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2025 Sergey S. Chernov real.sergeych@gmail.com
|
* Copyright 2026 Sergey S. Chernov real.sergeych@gmail.com
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -149,6 +149,8 @@ open class Obj {
|
|||||||
// methods that to override
|
// methods that to override
|
||||||
|
|
||||||
open suspend fun compareTo(scope: Scope, other: Obj): Int {
|
open suspend fun compareTo(scope: Scope, other: Obj): Int {
|
||||||
|
if( other === this) return 0
|
||||||
|
if( other === ObjNull ) return 2
|
||||||
scope.raiseNotImplemented()
|
scope.raiseNotImplemented()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user