scala coalesces multiple function call parameters into a Tuple — can this be disabled?

后端 未结 6 1689
闹比i
闹比i 2020-12-10 06:34

This is a troublesome violation of type safety in my project, so I\'m looking for a way to disable it. It seems that if a function takes an AnyRef (or a java.lang.Object), y

6条回答
  •  感动是毒
    2020-12-10 07:23

    Could you also add a two-param override, which would prevent the compiler applying the syntactic sugar? By making the types taking suitably obscure you're unlikely to get false positives. E.g:

    object WhyTuple {
    
      ...
    
      class DummyType
    
      def fooIt(a: DummyType, b: DummyType) {
        throw new UnsupportedOperationException("Dummy function - should not be called")
      }
    }
    

提交回复
热议问题