You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to Scala3.7.1-RC1-bin-SNAPSHOT-nonbootstrapped-git-f0c050e (23.0.2, JavaOpenJDK64-BitServerVM).
Type in expressions for evaluation. Ortry:help.
scala>caseclassC(i: Int, j: Int)
// defined case class C
scala>classD(c: C) { valC(j = y) = c }
--Error:----------------------------------------------------------------------1|classD(c: C) { valC(j = y) = c }
|^^^^^|Illegal combination of named and unnamed tuple elements
--Warning:--------------------------------------------------------------------1|classD(c: C) { valC(j = y) = c }
|^|pattern'stype (y : Int) is more specialized than the right hand side expression'stypeInt||If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
|which may result in a MatchError at runtime.
1 warning found
1 error found
scala>valc=C(42, 27)
valc:C=C(42,27)
scala> c match { caseC(j = y) => y }
valres0:Int=27
scala>classD(c: C) { valC(j = y) = c.runtimeChecked }
--Error:----------------------------------------------------------------------1|classD(c: C) { valC(j = y) = c.runtimeChecked }
|^^^^^^^^^^^^^^^^| method runtimeChecked is marked @experimental
||Experimental definition may only be used under experimental mode:
|1. in a definition marked as @experimental, or
|2. an experimental feature is imported at the packagelevel, or|3. compiling with the -experimental compiler flag.
1 error found
scala>classD(c: C) { valC(j = y) =c: @unchecked }
// defined class D
scala>D(c)
valres1:D=D@7462ba4b
scala> res1.y
valres2:Int=27
scala>
Different view:
scala>deff= { valC(i, j) = c; j }
deff:Int
scala>deff= { valC(i=i, j=j) = c; j }
1 warning found
--Warning:--------------------------------------------------------------------1|deff= { valC(i=i, j=j) = c; j }
|^|pattern'stype (i : Int) is more specialized than the right hand side expression'stypeInt||If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
|which may result in a MatchError at runtime.
deff:Int
scala>deff= { valC(j=j) = c; j }
--Error:----------------------------------------------------------------------1|deff= { valC(j=j) = c; j }
|^^^|Illegal combination of named and unnamed tuple elements
--Warning:--------------------------------------------------------------------1|deff= { valC(j=j) = c; j }
|^|pattern'stype (j : Int) is more specialized than the right hand side expression'stypeInt||If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
|which may result in a MatchError at runtime.
1 warning found
1 error found
Expectation
It should just quietly do my bidding.
The text was updated successfully, but these errors were encountered:
Minimized code
Different view:
Expectation
It should just quietly do my bidding.
The text was updated successfully, but these errors were encountered: