How can I print current user role in Twig?
You can use below without any function. Because the User module provides the variable in preprocess for all templates: :

{% set roles = user.getroles(TRUE) %}
{{ dump(roles) }}


If you want to do anything only for the particular role then do this:

{% if 'ROLENAME' in user.getroles(TRUE)  %}
  &lt;p&gt;The user has the role "ABC".&lt;/p&gt;
{% endif %}